I wrote a CharTerminatedInputStream class from scratch, heavily documented and should be highly robust (put it in the JAMES CVS tree). There are probably faster implementations as stream parsing isn't my forte, but this works very nicely. This solved the ".." problems at the end of messages. The other bug I fixed was buffering problems in SMTPHandler when you sent data too quickly. Interesting issue in stream buffering... SMTPHandler was taking socketIn and wrapping it in a BufferedReader to make readLine calls to get SMTP commands. When it came time to read the mime message (DATA command), it would wrap **socketIn** with CharTerminatedInputStream. The problem is that BufferedReader (and DataInputStream actually) both use a PushBackDataInputStream in its implementation, and what was happening was some data was getting lost in the buffer of the Buffereader and would not make it into the newly constructed CharTerminatedInputStream (it was already captured and stored in the PushBackDataInputStream). If you typed in data slowly enough, the buffer wouldn't get filled ahead of time, and it would work correctly. The solution was to wrap CharTerminatedInputStream around the BufferedReader, not socketIn. But because of the Reader vs. InputStream problems, I had to replace BufferedReader with DataInputStream (now using an admitedly deprecated readLine method). Now CharTerminatedInputStream works off of bytes fed through DataInputStream (so no bytes get lost in unread buffers). I also think it's probably a good idea to move from a Reader to just an InputStream because you don't want the mail server to do any character encoding. JavaSoft deprecated this because everyone should use localized data, but this kind of a server should just be passing bytes along in my mind. Sorry for being so long winded in some of my patch explanations... I just find some of these issues interesting and feel compelled to share. ;) JAMES is just about ready to ship! Serge Knystautas Loki Technologies http://www.lokitech.com/ ------------------------------------------------------------ To subscribe: [EMAIL PROTECTED] To unsubscribe: [EMAIL PROTECTED] Archives and Other: <http://java.apache.org/> Problems?: [EMAIL PROTECTED]
