Posted: November 23, 2013 00:18 by dm222
I have a message with a Message-ID that the JavaMail 1.5.1 IMAP ENVELOPE class won't parse.
The Message-ID was created in my test by JavaMail 1.5.1 UniqueValue.getUniqueMessageIDValue() method automatically when I sent the test message. The user.name on our company laptops has a backslash in it. So, the test message's Message-ID is generated like this - note the quote positions and backslashes:
My first question: Is this a legally formatted message ID?
If it is legal, then it appears that there is a bug in ENVELOPE.parseString(). When fetching and reading this message ID from my test IMAP server (on JavaMail 1.5.1), the ENVELOPE.parseString() method reads only up to the first quote character and stops and returns that. The subsequent code in ENVELOPE's constructor, at line 110, expects to see the final ")" and does not because parseString() terminated prematurely, and therefore throws a ParsingException.
If this Message-ID is not legal, then it appears there is a bug in UniqueValue.getUniqueMessageIDValue() that does not properly quote/escape a Message-ID that has a user.name system property that includes characters requiring escaping.
Or have I simply missed some basic understanding?