[jboss-dev-forums] [Design of JBoss Collaboration Server] - MessageData Bug (only in special case)

sappenin do-not-reply at jboss.com
Thu Aug 17 17:57:56 EDT 2006


Hey All,

I found this bug, and am looking for some guidance on how to fix it.  

If I draft a message in webmail, and send it to myself, then try to "get" the message via POP3, no POP3 messages are downloaded, and the server throws a NullPointerException as follows, breaking pop3 until I remove the "bad" message from my inbox:


  | 17:46:48,328 ERROR [STDERR] java.lang.NullPointerException
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.mailbox.MessageData.getBoundary(MessageData.java:345)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.pop3.handlers.CmdRETR.writeMessage(CmdRETR.java:124)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.pop3.handlers.CmdRETR.org$jboss$mail$pop3$handlers$CmdRETR$handleRequest$aop(CmdRETR.java:92)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.pop3.handlers.CmdRETR$handleRequest_6157744562547821338.invokeNext(CmdRETR$handleRequest_6157744562547821338.java)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.pop3.handlers.CmdRETR$handleRequest_6157744562547821338.invokeNext(CmdRETR$handleRequest_6157744562547821338.java)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.pop3.handlers.CmdRETR.handleRequest(CmdRETR.java)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.pop3.POP3ProtocolInstance.handleRequest(POP3ProtocolInstance.java:211)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.ConnectionHandler.runSocket(ConnectionHandler.java:205)
  | 17:46:48,328 ERROR [STDERR]     at org.jboss.mail.ConnectionHandler.run(ConnectionHandler.java:97)
  | 17:46:48,328 ERROR [STDERR]     at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
  | 17:46:48,328 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)
  | 

I've tracked this code down to the getBoundary() function of the MessageData class, here:


  | String[] header = getHeader("Content-Type").split("\\r\\n");
  | 

If I inspect the headers of a "JBCS webmail" created message, there isn't a "Content-type" header, which is why (I'm guessing) a null pointer is thrown.  The fix here may just be to check for a null string after calling getHeader("Content-Type").  

However, I'm not quite sure if this is the right thing.  Why does the boundary pivot around the "content-type" header?  Does the SMTP spec mandate that everything after this header must be the body?  Is content-type guaranteed to be last?  I'll write a fix for this, but I'm not quite sure what it's supposed to be doing.  I can see that CMDRetry.java line 124 is apparently using this a a boundary between message bodies (?).

Thanks!

David


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965911#3965911

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965911



More information about the jboss-dev-forums mailing list