You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by "Michael Jordan (JIRA)" <ji...@apache.org> on 2007/03/19 06:15:09 UTC
[jira] Created: (JCS-22) IllegalStateException and
NullPointerException thrown by CompositeCacheManager
IllegalStateException and NullPointerException thrown by CompositeCacheManager
------------------------------------------------------------------------------
Key: JCS-22
URL: https://issues.apache.org/jira/browse/JCS-22
Project: JCS
Issue Type: Bug
Components: Composite Cache
Affects Versions: jcs-1.2.7.9.2
Environment: N/A
Reporter: Michael Jordan
Assigned To: Aaron Smuts
Priority: Minor
If a cache configuration file does not exist on the classpath, an IllegalStateException is thrown by JCS.getInstance. This is not mentioned in the javadoc, and because it's not expected, crashes the calling program. Preferably, this should be a checked exception of some sort to force the caller to deal with this issue (potentially continuing their program with the cache disabled), but should at least be documented.
JCS.getInstance(cacheClassName)
java.lang.IllegalStateException: Failed to load properties for name [/cache.ccf]
at org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:239)
at org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:191)
at org.apache.jcs.engine.control.CompositeCacheManager.getInstance(CompositeCacheManager.java:119)
at org.apache.jcs.JCS.ensureCacheManager(JCS.java:99)
at org.apache.jcs.JCS.getInstance(JCS.java:64)
at com.telstra.tdsdi.cache.CacheManager.configure(CacheManager.java:72)
at com.telstra.tdsdi.cache.CacheManager.doWork(CacheManager.java:194)
at com.telstra.common.supervisor.SupervisedThread.run(SupervisedThread.java:39)
The next time that getInstance is called, and every time after that, JCS reacts differently - throwing a NullPointerException. This is inconsistent. Preferably, this should check to see whether the first 'configure' attempt was successful, and react accordingly. Optionally it could throw the same exception as the first call, or failing that, should at least be documented in the javadoc for this method.
java.lang.NullPointerException
at org.apache.jcs.config.OptionConverter.findAndSubst(OptionConverter.java:289)
at org.apache.jcs.config.OptionConverter.instantiateByKey(OptionConverter.java:167)
at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseElementAttributes(CompositeCacheConfigurator.java:438)
at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:304)
at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:280)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:445)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:384)
at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:371)
at org.apache.jcs.JCS.getInstance(JCS.java:66)
at com.telstra.tdsdi.cache.CacheManager.configure(CacheManager.java:72)
at com.telstra.tdsdi.cache.CacheManager.doWork(CacheManager.java:194)
at com.telstra.common.supervisor.SupervisedThread.run(SupervisedThread.java:39)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org
[jira] Updated: (JCS-22) IllegalStateException and
NullPointerException thrown by CompositeCacheManager
Posted by "Thomas Vandahl (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCS-22?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Vandahl updated JCS-22:
------------------------------
Fix Version/s: jcs-1.4-dev
Affects Version/s: (was: jcs-1.2.7.9.2)
jcs-1.3
> IllegalStateException and NullPointerException thrown by CompositeCacheManager
> ------------------------------------------------------------------------------
>
> Key: JCS-22
> URL: https://issues.apache.org/jira/browse/JCS-22
> Project: JCS
> Issue Type: Bug
> Components: Composite Cache
> Affects Versions: jcs-1.3
> Environment: N/A
> Reporter: Michael Jordan
> Assignee: Aaron Smuts
> Priority: Minor
> Fix For: jcs-1.4-dev
>
>
> If a cache configuration file does not exist on the classpath, an IllegalStateException is thrown by JCS.getInstance. This is not mentioned in the javadoc, and because it's not expected, crashes the calling program. Preferably, this should be a checked exception of some sort to force the caller to deal with this issue (potentially continuing their program with the cache disabled), but should at least be documented.
> JCS.getInstance(cacheClassName)
> java.lang.IllegalStateException: Failed to load properties for name [/cache.ccf]
> at org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:239)
> at org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeCacheManager.java:191)
> at org.apache.jcs.engine.control.CompositeCacheManager.getInstance(CompositeCacheManager.java:119)
> at org.apache.jcs.JCS.ensureCacheManager(JCS.java:99)
> at org.apache.jcs.JCS.getInstance(JCS.java:64)
> at com.telstra.tdsdi.cache.CacheManager.configure(CacheManager.java:72)
> at com.telstra.tdsdi.cache.CacheManager.doWork(CacheManager.java:194)
> at com.telstra.common.supervisor.SupervisedThread.run(SupervisedThread.java:39)
> The next time that getInstance is called, and every time after that, JCS reacts differently - throwing a NullPointerException. This is inconsistent. Preferably, this should check to see whether the first 'configure' attempt was successful, and react accordingly. Optionally it could throw the same exception as the first call, or failing that, should at least be documented in the javadoc for this method.
> java.lang.NullPointerException
> at org.apache.jcs.config.OptionConverter.findAndSubst(OptionConverter.java:289)
> at org.apache.jcs.config.OptionConverter.instantiateByKey(OptionConverter.java:167)
> at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseElementAttributes(CompositeCacheConfigurator.java:438)
> at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:304)
> at org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:280)
> at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:445)
> at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:384)
> at org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:371)
> at org.apache.jcs.JCS.getInstance(JCS.java:66)
> at com.telstra.tdsdi.cache.CacheManager.configure(CacheManager.java:72)
> at com.telstra.tdsdi.cache.CacheManager.doWork(CacheManager.java:194)
> at com.telstra.common.supervisor.SupervisedThread.run(SupervisedThread.java:39)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org