bbottema/outlook-message-parser

java.lang.NumberFormatException: For input string: "101f-00000001"

FibreFoX opened this issue · 10 comments

I am having trouble with some stored .msg-files I want to load/parse.

final OutlookMessageParser parser = new OutlookMessageParser();

try{
    parser.parseMsg("somefile.msg");
} catch(Throwable ex){
    // NO-OP please ignore, this is example code, you know
}

When trying to load the file I get this stacktrace:

23:28:23.790 [main] INFO org.simplejavamail.outlookmessageparser.OutlookMessageParser - Could not parse directory entry __substg1.0_8009101F-00000001
java.lang.NumberFormatException: For input string: "101f-00000001"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.analyzeDocumentEntry(OutlookMessageParser.java:577)
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.getMessagePropertyFromDocumentEntry(OutlookMessageParser.java:395)
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryDocumentEntry(OutlookMessageParser.java:258)
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryEntry(OutlookMessageParser.java:204)
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:129)
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:98)

Using some example-files (https://github.com/bbottema/outlook-message-parser/tree/master/src/test/resources/test-messages) provided by this project it works. I will try to get some example file ready, but as this is some kind of paid-work stuff, this will take some time to provide a proper .msg-file for debugging.

Just wanted to add, that using Apache POI directly by calling new org.apache.poi.hsmf.MAPIMessage(new File("somefile.msg")) seems to work.

So... I'm a little confused here. The .msg you referenced is not actually an email, but seems to be an Outlook contact card. I didn't know that was possible, but there you go.

Also see: default file extension for contacts changes to .msg

When you drag and drop the contact information from Outlook onto desktop, by default it saves in .msg format.

Maybe you misunderstood me, I do have valid msg-files that are emails, not contact cards. This issue still exists, but my given example was not as my actual setup is. Can you please re-open this issue? I will try to provide some example-file, but this will take some time.

Ok, sure.

Any update?

Sorry, sadly I got no approval to share some e-mails :/ mostly due to restricted information. As I am not using this lib anymore, you might want to close this. Not interested in this anymore.

That's unfortunate, I would love to make the library usable for you, but as it stands this bug report doesn't have enough for me to go on. If you do have an example now or in the future, a heads up would be greatly appreciated. Closing for now...

I have this problem with every email I parse with the normal simple java mail outlook module.
I just paste a few of the errors because otherwise this comment was way too long.


java.lang.NumberFormatException: For input string: "101f-00000004" under radix 16
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) ~[na:na]
	at java.base/java.lang.Integer.parseInt(Integer.java:658) ~[na:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.analyzeDocumentEntry(OutlookMessageParser.java:581) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.getMessagePropertyFromDocumentEntry(OutlookMessageParser.java:399) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryDocumentEntry(OutlookMessageParser.java:262) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryEntry(OutlookMessageParser.java:208) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:133) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.parseOutlookMsg(OutlookEmailConverter.java:119) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:62) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201) ~[simple-java-mail-6.4.4.jar:na]


2020-10-27 15:19:41.362  INFO 17236 --- [    Test worker] o.s.o.OutlookMessageParser               : Could not parse directory entry __substg1.0_8011101F-00000006

java.lang.NumberFormatException: For input string: "101f-00000006" under radix 16
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) ~[na:na]
	at java.base/java.lang.Integer.parseInt(Integer.java:658) ~[na:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.analyzeDocumentEntry(OutlookMessageParser.java:581) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.getMessagePropertyFromDocumentEntry(OutlookMessageParser.java:399) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryDocumentEntry(OutlookMessageParser.java:262) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryEntry(OutlookMessageParser.java:208) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:133) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.parseOutlookMsg(OutlookEmailConverter.java:119) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:62) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201) ~[simple-java-mail-6.4.4.jar:na]


2020-10-27 15:19:41.386  INFO 17236 --- [    Test worker] o.s.o.OutlookMessageParser               : Could not parse directory entry __substg1.0_8011101F-00000007

java.lang.NumberFormatException: For input string: "101f-00000007" under radix 16
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) ~[na:na]
	at java.base/java.lang.Integer.parseInt(Integer.java:658) ~[na:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.analyzeDocumentEntry(OutlookMessageParser.java:581) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.getMessagePropertyFromDocumentEntry(OutlookMessageParser.java:399) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryDocumentEntry(OutlookMessageParser.java:262) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryEntry(OutlookMessageParser.java:208) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:133) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.parseOutlookMsg(OutlookEmailConverter.java:119) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:62) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201) ~[simple-java-mail-6.4.4.jar:na]


2020-10-27 15:19:41.399  INFO 17236 --- [    Test worker] o.s.o.OutlookMessageParser               : Could not parse directory entry __substg1.0_8011101F-00000005

java.lang.NumberFormatException: For input string: "101f-00000005" under radix 16
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) ~[na:na]
	at java.base/java.lang.Integer.parseInt(Integer.java:658) ~[na:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.analyzeDocumentEntry(OutlookMessageParser.java:581) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.getMessagePropertyFromDocumentEntry(OutlookMessageParser.java:399) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryDocumentEntry(OutlookMessageParser.java:262) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryEntry(OutlookMessageParser.java:208) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:133) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.parseOutlookMsg(OutlookEmailConverter.java:119) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:62) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201) ~[simple-java-mail-6.4.4.jar:na]

2020-10-27 15:19:41.432  INFO 17236 --- [    Test worker] o.s.o.OutlookMessageParser               : Could not parse directory entry __substg1.0_8011101F-00000002

java.lang.NumberFormatException: For input string: "101f-00000002" under radix 16
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) ~[na:na]
	at java.base/java.lang.Integer.parseInt(Integer.java:658) ~[na:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.analyzeDocumentEntry(OutlookMessageParser.java:581) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.getMessagePropertyFromDocumentEntry(OutlookMessageParser.java:399) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryDocumentEntry(OutlookMessageParser.java:262) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryEntry(OutlookMessageParser.java:208) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:133) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.parseOutlookMsg(OutlookEmailConverter.java:119) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:62) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201) ~[simple-java-mail-6.4.4.jar:na]


2020-10-27 15:19:41.446  INFO 17236 --- [    Test worker] o.s.o.OutlookMessageParser               : Could not parse directory entry __substg1.0_8011101F-00000003

java.lang.NumberFormatException: For input string: "101f-00000003" under radix 16
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) ~[na:na]
	at java.base/java.lang.Integer.parseInt(Integer.java:658) ~[na:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.analyzeDocumentEntry(OutlookMessageParser.java:581) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.getMessagePropertyFromDocumentEntry(OutlookMessageParser.java:399) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryDocumentEntry(OutlookMessageParser.java:262) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryEntry(OutlookMessageParser.java:208) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:133) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.parseOutlookMsg(OutlookEmailConverter.java:119) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:62) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201) ~[simple-java-mail-6.4.4.jar:na]


2020-10-27 15:19:41.460  INFO 17236 --- [    Test worker] o.s.o.OutlookMessageParser               : Could not parse directory entry __substg1.0_8011101F-00000001

java.lang.NumberFormatException: For input string: "101f-00000001" under radix 16
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) ~[na:na]
	at java.base/java.lang.Integer.parseInt(Integer.java:658) ~[na:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.analyzeDocumentEntry(OutlookMessageParser.java:581) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.getMessagePropertyFromDocumentEntry(OutlookMessageParser.java:399) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryDocumentEntry(OutlookMessageParser.java:262) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.checkDirectoryEntry(OutlookMessageParser.java:208) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.outlookmessageparser.OutlookMessageParser.parseMsg(OutlookMessageParser.java:133) ~[outlook-message-parser-1.7.5.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.parseOutlookMsg(OutlookEmailConverter.java:119) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:62) ~[outlook-module-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:226) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:209) ~[simple-java-mail-6.4.4.jar:na]
	at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:201) ~[simple-java-mail-6.4.4.jar:na]

I attached an example email to the comment.

test.msg

The sample test file was most helpful. I release a fix (at least for the sample file) in 1.7.9, please verify!