Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6C4AB70FA for ; Sat, 5 Nov 2011 19:13:16 +0000 (UTC) Received: (qmail 23947 invoked by uid 500); 5 Nov 2011 19:13:16 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 23864 invoked by uid 500); 5 Nov 2011 19:13:16 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 23856 invoked by uid 99); 5 Nov 2011 19:13:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Nov 2011 19:13:16 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Nov 2011 19:13:13 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id D0691360E8 for ; Sat, 5 Nov 2011 19:12:51 +0000 (UTC) Date: Sat, 5 Nov 2011 19:12:51 +0000 (UTC) From: "Thomas Vandahl (Resolved) (JIRA)" To: issues@commons.apache.org Message-ID: <983504198.3505.1320520371855.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (JCS-22) IllegalStateException and NullPointerException thrown by CompositeCacheManager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JCS-22?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Vandahl resolved JCS-22. ------------------------------- Resolution: Fixed Fixed in SVN. JCS will now throw a CacheException in this case. > 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. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira