bug found

Archit Shah <[email protected]> Tue, 07 Jun 2005 16:52:35 -0400
Newsgroups gmane.comp.java.classpath.extensions.javamail
Message-ID <[email protected]>
A bug in classpathx mail was found when using it with Apache Axis. The 
problem is in source/javax/mail/internet/InternetHeaders.java. I've 
attached a junit test case that shows how the class operates differently 
on buffered versus unbuffered input streams. I believe line 335 is the key:

LineInputStream in = new LineInputStream(new CRLFInputStream(is));

The CRLFInputStream wraps the original input stream in a buffered input 
stream when markSupported() returns false. If there is data in the 
original input stream after the headers, then it gets lost in the 
buffered input stream created in the CRLFInputStream constructor. 
Changing InternetHeaders to not use CRLFInputStream seems to fix the 
problem (patch attached):

LineInputStream in = new LineInputStream(is);

This change also re-instates the recognition of either '\n' or '\r\n' as 
  line terminators in header parsing. This matches the behavior of the 
rfc822 module in python 2.3 and doesn't seem unreasonable.

  -- Archit Shah

_______________________________________________
Classpathx-javamail mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpathx-javamail