|
Loading...
|
javamail-interest@java.sun.com
[Prev] Thread [Next] | [Prev] Date [Next]
Re: NullpointerException when closing folder Wolfgang Beikircher Tue Mar 24 06:01:02 2009
Hi Bill!
Now I saw what the problem is: in principle there is only one
possibility to cause a NullPointerException => if you run out of memory.
And exactly that happend. The reason why I don't figured it out earlier
is because I don't checked the catalina.out file of Tomcat. Anyway, I
corrected now my source code in the way, that I transfer smaller chunks
of data.
Sincerely,
Wolfgang
On Fri, 2009-03-20 at 11:39 -0700, Bill Shannon wrote:
> Wolfgang Beikircher wrote:
> > Hi there!
> >
> > I'm using JavaMail 1.4.2 and get an NullPointerException when I try to
> > close a folder. This happens only after some hours of run time of my
> > application. Therefore, I think it has something to do with the
> > connection timeout to the server.
> >
> > This is the error stack:
> >
> > Caused by: java.lang.NullPointerException
> > at com.sun.mail.iap.Protocol.command(Protocol.java:324)
> > at
> > com.sun.mail.imap.protocol.IMAPProtocol.logout(IMAPProtocol.java:311)
> > at com.sun.mail.imap.IMAPStore.releaseProtocol(IMAPStore.java:944)
> > at com.sun.mail.imap.IMAPFolder.releaseProtocol(IMAPFolder.java:2666)
> > at com.sun.mail.imap.IMAPFolder.cleanup(IMAPFolder.java:1143)
> > at com.sun.mail.imap.IMAPFolder.close(IMAPFolder.java:1132)
> > at com.sun.mail.imap.IMAPFolder.close(IMAPFolder.java:1055)
> > at com.sun.mail.imap.IMAPStore.cleanup(IMAPStore.java:1289)
> > at com.sun.mail.imap.IMAPStore.handleResponse(IMAPStore.java:1509)
> > at com.sun.mail.iap.Protocol.notifyResponseHandlers(Protocol.java:216)
> > at
> > com.sun.mail.imap.protocol.IMAPProtocol.logout(IMAPProtocol.java:316)
> > at com.sun.mail.imap.IMAPStore.close(IMAPStore.java:1217)
> > at
> > org.zimbra.exchange.email.transport.ImapMailServerWrapper.releaseConnection(ImapMailServerWrapper.java:129)
> > ... 7 more
>
> You may be right about a timeout causing this problem, but I'm
> struggling to see why a timeout would cause this NullPointerException.
>
> The code in Protocol.java is:
>
> public synchronized Response[] command(String command, Argument args) {
> Vector v = new Vector();
> boolean done = false;
> String tag = null;
> Response r = null;
>
> // write the command
> try {
> tag = writeCommand(command, args);
> } catch (LiteralException lex) {
> v.addElement(lex.getResponse());
> done = true;
> } catch (Exception ex) {
> // Convert this into a BYE response
> v.addElement(Response.byeResponse(ex));
> done = true;
> }
>
> while (!done) {
> try {
> r = readResponse();
> } catch (IOException ioex) {
> // convert this into a BYE response
> r = Response.byeResponse(ioex);
> } catch (ProtocolException pex) {
> continue; // skip this response
> }
>
> v.addElement(r);
>
> if (r.isBYE()) // shouldn't wait for command completion response
> done = true;
>
> // If this is a matching command completion response, we are done
> if (r.isTagged() && r.getTag().equals(tag))
> done = true;
> }
>
> Response[] responses = new Response[v.size()];
> v.copyInto(responses); // <---- line 324
> timestamp = System.currentTimeMillis();
> return responses;
> }
>
> "v" can't be null. "responses" can't be null.
> Even if one of the elements in v is null (which shouldn't happen),
> that wouldn't cause the NullPointerException.
>
> What am I missing?
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
- NullpointerException when closing folder Wolfgang Beikircher 2009/03/20
- Re: NullpointerException when closing folder Bill Shannon 2009/03/20
- Re: NullpointerException when closing folder Wolfgang Beikircher 2009/03/24 <=
- Re: NullpointerException when closing folder Bill Shannon 2009/03/24