Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
jcs-1.3
-
None
-
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-9M3165)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode)
Description
When an attempt is made to use torque's JCS support, JCS crashes on initialisation with a NullPointerException as below.
The cause is that CompositeCacheConfiguration.parseRegion is passed a parameter called "value", and this value is not guarded against being null. The failure happens on this line:
StringTokenizer st = new StringTokenizer( value, "," );
If value is a required string, a proper error message explaining exactly what the problem is, and exactly what the end user must do to fix it should be thrown.
Looking further, the "value" comes from this field in CompositeCacheManager:
/** The default auxiliary caches to be used if not preconfigured */
protected String defaultAuxValues;
This field is given no default value, and no documentation exists explaining how an end user might populate this value, or what the significance of this value is.
The full stack trace looks like this:
Caused by: java.lang.NullPointerException
at java.util.StringTokenizer.<init>(StringTokenizer.java:182)
at java.util.StringTokenizer.<init>(StringTokenizer.java:204)
at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:321)
at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:283)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:448)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:387)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:374)
at org.apache.jcs.JCS.getInstance(JCS.java:66)