Changeset 279
- Timestamp:
- 08/28/08 07:07:55 PM (4 months ago)
- Location:
- trunk/LogicMail/src/org/logicprobe/LogicMail
- Files:
-
- 2 modified
-
mail/imap/ImapParser.java (modified) (2 diffs)
-
util/StringParser.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LogicMail/src/org/logicprobe/LogicMail/mail/imap/ImapParser.java
r275 r279 283 283 } 284 284 285 // Find the BODYSTRUCTURE portion of the reply 286 Vector parsedStruct = null; 287 int size = parsedText.size(); 288 289 for (int i = 0; i < size; i++) { 290 if (parsedText.elementAt(i) instanceof String) { 291 String label = (String) parsedText.elementAt(i); 292 293 if (label.equalsIgnoreCase("BODYSTRUCTURE") && 294 (i < (size - 1)) && 295 parsedText.elementAt(i + 1) instanceof Vector) { 296 parsedStruct = (Vector) parsedText.elementAt(i + 1); 297 } 298 } 299 } 300 285 301 // Sanity checking 286 if ((parsedText.size() < 2) || 287 !(parsedText.elementAt(1) instanceof Vector)) { 302 if (parsedStruct == null) { 288 303 EventLogger.logEvent(AppInfo.GUID, 289 304 "ImapParser.parseMessageStructure: Sanity check failed".getBytes(), … … 293 308 } 294 309 295 Vector parsedStruct = (Vector) parsedText.elementAt(1);296 310 MessageSection msgStructure = parseMessageStructureHelper(null, 1, 297 311 parsedStruct); -
trunk/LogicMail/src/org/logicprobe/LogicMail/util/StringParser.java
r275 r279 879 879 if ((index + 2) >= length) { 880 880 break; 881 } 882 883 try { 884 int charVal = Integer.parseInt(text.substring(index + 1, 885 index + 3), 16); 886 buffer.append((char) charVal); 887 } catch (NumberFormatException exp) { 888 } 889 890 index += 3; 881 } else { 882 char ch1 = text.charAt(index + 1); 883 char ch2 = text.charAt(index + 2); 884 885 if ((ch1 == '\r') && (ch2 == '\n')) { 886 index += 3; 887 } else if (ch1 == '\n') { 888 index += 2; 889 } else { 890 try { 891 int charVal = Integer.parseInt(text.substring(index + 892 1, index + 3), 16); 893 buffer.append((char) charVal); 894 } catch (NumberFormatException exp) { 895 } 896 897 index += 3; 898 } 899 } 891 900 } else { 892 901 buffer.append(text.charAt(index)); … … 905 914 char ch; 906 915 String charStr; 907 908 for (int i = 0; i < text.length(); i++) { 916 int length = text.length(); 917 918 for (int i = 0; i < length; i++) { 909 919 ch = text.charAt(i); 910 920 911 if (ch < 128) { 921 if ((ch != '\t') && (ch != ' ') && (ch < 128)) { 922 if ((buffer.length() == 75) && (i < (length - 1))) { 923 buffer.append("=\r\n"); 924 } 925 912 926 buffer.append(ch); 913 927 } else { 914 charStr = Integer.toHexString((int) ch); 928 if ((buffer.length() == 73) && (i < (length - 3))) { 929 buffer.append("=\r\n"); 930 } 931 932 charStr = Integer.toHexString((int) ch).toUpperCase(); 915 933 buffer.append('='); 916 934
