EHC ❯ Possible problem in MulticastServerThread clas
-
Bug
-
Status: Closed
-
-
Resolution: Fixed
-
-
-
drb
-
Reporter: sourceforgetracker
-
September 21, 2009
-
0
-
Watchers: 0
-
September 22, 2009
-
September 22, 2009
Description
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.
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
Comments
Sourceforge Tracker 2009-09-21
Fiona OShea 2009-09-22
Re-opening so that I can properly close out these issues and have correct Resolution status in Jira
Logged In: YES user_id=693320
Roman,
Yes, a startup and immediate shudown could theoretically cause the NPE. Added the fix as suggested. Is in trunk. Will be in 1.2.1.
If you find any biggies in this area let me know!
Regards Greg Comment by: gregluck - 3 May 2006 08:20 UTC