Opened 7 years ago

Closed 6 years ago

#809 closed defect (fixed)

NPE in POP3MailBox

Reported by: Zlatin Balevsky Owned by: Zlatin Balevsky
Priority: minor Milestone: 0.9.13
Component: apps/susimail Version: 0.9.3
Keywords: susi npe Cc: Zlatin Balevsky
Parent Tickets: Sensitive: no

Description

While checking email with Susi:

java.lang.NullPointerException
	at i2p.susi.webmail.pop3.POP3MailBox.sendCmd1a(POP3MailBox.java:423)
	at i2p.susi.webmail.pop3.POP3MailBox.sendCmdNa(POP3MailBox.java:531)
	at i2p.susi.webmail.pop3.POP3MailBox.sendCmdN(POP3MailBox.java:463)
	at i2p.susi.webmail.pop3.POP3MailBox.sendCmdN(POP3MailBox.java:447)
	at i2p.susi.webmail.pop3.POP3MailBox.getHeader(POP3MailBox.java:122)
	at i2p.susi.webmail.pop3.POP3MailBox.getHeader(POP3MailBox.java:92)
	at i2p.susi.webmail.MailCache.getMail(MailCache.java:83)
	at i2p.susi.webmail.WebMail.processRequest(WebMail.java:1245)
	at i2p.susi.webmail.WebMail.doPost(WebMail.java:1530)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)

Subtickets

Change History (3)

comment:1 Changed 7 years ago by str4d

The line in question is:

socket.getOutputStream().write(cmd.getBytes());

The line before is cmd += "\r\n";, meaning that cmd is not null. So either the socket was null or socket.getOutputStream() returned null.

comment:2 Changed 6 years ago by zzz

getOutputStream() throws IOE, it will not return null. So socket is null.

sendCmdN() checks for isConnected() but not socket == null.

sendCmdNa() doesn't check for socket == null either before calling sendCmd1a().

Some of the other calls to sendCmd1a() in the file check for socket == null first, but some don't.

Seems like a messy interrelation of isConnected() and socket == null and the synchronization. Not clear how to untangle it.

comment:3 Changed 6 years ago by zzz

Milestone: 0.9.13
Resolution: fixed
Status: newclosed

I'm going to optimistically declare this fixed in the big rewrite in the 0.9.12-x cycle. Lots of synchronization added to POP3MailBox.

Note: See TracTickets for help on using tickets.