#30 NullPointerException in thread "Shutdown" - tray disposal - server mode

Unstable (example)
open-fixed
None
5
2014-01-03
2013-12-29
No

If davmail.server = true, the davGatewayTray variable is never initialized. When DavMail is shutdown, the dispose method is called and runs into a NullPointerException.

2013-12-29 14:56:04,425 DEBUG [Shutdown] davmail  - Stopping DavMail gateway
2013-12-29 14:56:04,427 INFO  [Shutdown] davmail  - DavMail gateway stopped
Exception in thread "Shutdown" java.lang.NullPointerException
    at davmail.ui.tray.DavGatewayTray.dispose(DavGatewayTray.java:294)
    at davmail.DavGateway.stop(DavGateway.java:176)
    at davmail.DavGateway$1.run(DavGateway.java:77)

To prevent this exception, I added a null check for the davGatewayTray variable.

public static void dispose() {
    if (davGatewayTray != null) {
        davGatewayTray.dispose();
    }
}
1 Attachments

Discussion

  • Mickael Guessant

    • status: open --> open-fixed
     
  • Mickael Guessant

    Patch merged, thanks for your contribution

     
    Last edit: Mickael Guessant 2014-01-03

Log in to post a comment.