• Bug
  • Status: Closed
  • Resolution: Fixed
  • drb
  • Reporter: sourceforgetracker
  • September 21, 2009
  • 0
  • Watchers: 0
  • September 22, 2009
  • September 22, 2009

Description

Hi, net.sf.ehcache.management.CacheStatistics class has a method:

public String getAssociatedCacheName() {
    return statistics.getAssociatedCacheName();
}

If this method is called (through JMX or an administration interface of Spring context) before the cache is even used, then the statiscs member is not initialized and is null, and causes a NPE.

How about this as a fix ?

public String getAssociatedCacheName() {
    return (statistics == null ? "N/A" : statistics.getAssociatedCacheName();
}

Regards, Bulent Erdemir Sourceforge Ticket ID: 1828351 - Opened By: bulenterdemir - 8 Nov 2007 15:29 UTC

Comments

Sourceforge Tracker 2009-09-21

Logged In: YES user_id=693320 Originator: NO

Hi

The Javadoc says it should return null. I added the NPE guard but it return null if there is no statistics object.

The fix is in trunk and will be in ehcache-1.4 beta2.

Greg Comment by: gregluck - 13 Nov 2007 08:05 UTC

Fiona OShea 2009-09-22

Re-opening so that I can properly close out these issues and have correct Resolution status in Jira