java.lang.NullPointerException

Terracotta Project Issue Tracker | Sourceforge Tracker | 7 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    It seems like there is a small "bug" in the MulticastServerThread class (file MulticastKeepaliveHeartbeatSender.java). In line 192 (revision 52), the code looks like: if (!socket.isClosed()) { but it would be better if it looked like: if ((socket != null) && (!socket.isClosed())) { because I get a NullPointerException if the application terminates before Java is able to start the thread. If I run the application in the debugger (with a breakpoint), the thread has enough time to create the MulticastSocket object. Exception in thread "main" java.lang.NullPointerException at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatSender$MulticastServerThread.closeSocket(MulticastKeepaliveHeartbeatSender.java:192) at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatSender$MulticastServerThread.interrupt(MulticastKeepaliveHeartbeatSender.java:186) at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatSender.dispose(MulticastKeepaliveHeartbeatSender.java:78) at net.sf.ehcache.distribution.MulticastRMICacheManagerPeerProvider.dispose(MulticastRMICacheManagerPeerProvider.java:172) at net.sf.ehcache.CacheManager.shutdown(CacheManager.java:526) at go.<init>(go.java:57) at go.main(go.java:21) This is of course not a big problem because it is very rare that an application uses the Cache and terminates THAT quickly.... ;) Thanks, Roman Sourceforge Ticket ID: 1480442 - Opened By: roman_k - 2 May 2006 14:45 UTC

    Terracotta Project Issue Tracker | 7 years ago | Sourceforge Tracker
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatSender$MulticastServerThread.closeSocket()
    2. Ehcache
      CacheManager.shutdown
      1. net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatSender$MulticastServerThread.closeSocket(MulticastKeepaliveHeartbeatSender.java:192)
      2. net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatSender$MulticastServerThread.interrupt(MulticastKeepaliveHeartbeatSender.java:186)
      3. net.sf.ehcache.distribution.MulticastKeepaliveHeartbeatSender.dispose(MulticastKeepaliveHeartbeatSender.java:78)
      4. net.sf.ehcache.distribution.MulticastRMICacheManagerPeerProvider.dispose(MulticastRMICacheManagerPeerProvider.java:172)
      5. net.sf.ehcache.CacheManager.shutdown(CacheManager.java:526)
      5 frames
    3. Unknown
      go.main
      1. go.<init>(go.java:57)
      2. go.main(go.java:21)
      2 frames