Loading src/com/android/bluetooth/map/BluetoothMapContentEmail.java +4 −0 Original line number Diff line number Diff line Loading @@ -1787,6 +1787,10 @@ public class BluetoothMapContentEmail extends BluetoothMapContent { message.setType(TYPE.EMAIL); message.setVersionString(mMessageVersion); message.setContentType("Content-Type: text/plain; charset=\"UTF-8\""); message.setDate(c.getLong(c.getColumnIndex(BluetoothMapEmailContract .ExtEmailMessageColumns.TIMESTAMP))); message.setSubject(c.getString(c.getColumnIndex(BluetoothMapContract .MessageColumns.SUBJECT))); // Set folder: long folderId = c.getLong( c.getColumnIndex(BluetoothMapEmailContract .ExtEmailMessageColumns.MAILBOX_KEY)); Loading src/com/android/bluetooth/map/BluetoothMapbMessage.java +18 −17 Original line number Diff line number Diff line Loading @@ -431,10 +431,13 @@ public abstract class BluetoothMapbMessage { public String getLine() { try { byte[] line = getLineAsBytes(); if (line.length == 0) if (line == null) { return null; else } else if (line.length == 0) { return null; } else { return new String(line, "UTF-8"); } } catch (UnsupportedEncodingException e) { Log.w(TAG, e); return null; Loading Loading @@ -482,13 +485,19 @@ public abstract class BluetoothMapbMessage { */ public void expect(String subString, String subString2) throws IllegalArgumentException{ String line = getLine(); if(!line.toUpperCase().contains(subString.toUpperCase())) if (line == null || subString == null) { throw new IllegalArgumentException("Line or substring is null"); } else if (!line.toUpperCase().contains(subString.toUpperCase())) { throw new IllegalArgumentException("Expected \"" + subString + "\" in: \"" + line + "\""); if(!line.toUpperCase().contains(subString2.toUpperCase())) } if (line == null || subString2 == null) { throw new IllegalArgumentException("Line or substring is null"); } else if (!line.toUpperCase().contains(subString2.toUpperCase())) { throw new IllegalArgumentException("Expected \"" + subString + "\" in: \"" + line + "\""); } } /** * Read a part of the bMessage as raw data. Loading Loading @@ -857,24 +866,16 @@ public abstract class BluetoothMapbMessage { * END:MSG in the actual message content, it is now safe to use the END:MSG tag * as terminator, and simply ignore the length field.*/ /* 2 added to compensate for the removed \r\n */ byte[] rawData = reader.getDataBytes(mBMsgLength - (line.getBytes().length + 2)); String data; try { data = new String(rawData, "UTF-8"); String data = reader.getStringTerminator("END:MSG"); if(V) { Log.v(TAG,"MsgLength: " + mBMsgLength); Log.v(TAG,"line.getBytes().length: " + line.getBytes().length); Log.v(TAG,"data.getBytes().length: " + data.getBytes().length); String debug = line.replaceAll("\\n", "<LF>\n"); debug = debug.replaceAll("\\r", "<CR>"); Log.v(TAG,"The line: \"" + debug + "\""); debug = data.replaceAll("\\n", "<LF>\n"); debug = debug.replaceAll("\\r", "<CR>"); Log.v(TAG,"The msgString: \"" + debug + "\""); } } catch (UnsupportedEncodingException e) { Log.w(TAG,e); throw new IllegalArgumentException("Unable to convert to UTF-8"); Log.v(TAG, "The msgString: \"" + data + "\""); } /* Decoding of MSG: * 1) split on "\r\nEND:MSG\r\n" Loading Loading
src/com/android/bluetooth/map/BluetoothMapContentEmail.java +4 −0 Original line number Diff line number Diff line Loading @@ -1787,6 +1787,10 @@ public class BluetoothMapContentEmail extends BluetoothMapContent { message.setType(TYPE.EMAIL); message.setVersionString(mMessageVersion); message.setContentType("Content-Type: text/plain; charset=\"UTF-8\""); message.setDate(c.getLong(c.getColumnIndex(BluetoothMapEmailContract .ExtEmailMessageColumns.TIMESTAMP))); message.setSubject(c.getString(c.getColumnIndex(BluetoothMapContract .MessageColumns.SUBJECT))); // Set folder: long folderId = c.getLong( c.getColumnIndex(BluetoothMapEmailContract .ExtEmailMessageColumns.MAILBOX_KEY)); Loading
src/com/android/bluetooth/map/BluetoothMapbMessage.java +18 −17 Original line number Diff line number Diff line Loading @@ -431,10 +431,13 @@ public abstract class BluetoothMapbMessage { public String getLine() { try { byte[] line = getLineAsBytes(); if (line.length == 0) if (line == null) { return null; else } else if (line.length == 0) { return null; } else { return new String(line, "UTF-8"); } } catch (UnsupportedEncodingException e) { Log.w(TAG, e); return null; Loading Loading @@ -482,13 +485,19 @@ public abstract class BluetoothMapbMessage { */ public void expect(String subString, String subString2) throws IllegalArgumentException{ String line = getLine(); if(!line.toUpperCase().contains(subString.toUpperCase())) if (line == null || subString == null) { throw new IllegalArgumentException("Line or substring is null"); } else if (!line.toUpperCase().contains(subString.toUpperCase())) { throw new IllegalArgumentException("Expected \"" + subString + "\" in: \"" + line + "\""); if(!line.toUpperCase().contains(subString2.toUpperCase())) } if (line == null || subString2 == null) { throw new IllegalArgumentException("Line or substring is null"); } else if (!line.toUpperCase().contains(subString2.toUpperCase())) { throw new IllegalArgumentException("Expected \"" + subString + "\" in: \"" + line + "\""); } } /** * Read a part of the bMessage as raw data. Loading Loading @@ -857,24 +866,16 @@ public abstract class BluetoothMapbMessage { * END:MSG in the actual message content, it is now safe to use the END:MSG tag * as terminator, and simply ignore the length field.*/ /* 2 added to compensate for the removed \r\n */ byte[] rawData = reader.getDataBytes(mBMsgLength - (line.getBytes().length + 2)); String data; try { data = new String(rawData, "UTF-8"); String data = reader.getStringTerminator("END:MSG"); if(V) { Log.v(TAG,"MsgLength: " + mBMsgLength); Log.v(TAG,"line.getBytes().length: " + line.getBytes().length); Log.v(TAG,"data.getBytes().length: " + data.getBytes().length); String debug = line.replaceAll("\\n", "<LF>\n"); debug = debug.replaceAll("\\r", "<CR>"); Log.v(TAG,"The line: \"" + debug + "\""); debug = data.replaceAll("\\n", "<LF>\n"); debug = debug.replaceAll("\\r", "<CR>"); Log.v(TAG,"The msgString: \"" + debug + "\""); } } catch (UnsupportedEncodingException e) { Log.w(TAG,e); throw new IllegalArgumentException("Unable to convert to UTF-8"); Log.v(TAG, "The msgString: \"" + data + "\""); } /* Decoding of MSG: * 1) split on "\r\nEND:MSG\r\n" Loading