EHC ❯ Cannot load configuration from jar (or any non-file URL)
-
Bug
-
Status: Closed
-
-
Resolution: Fixed
-
-
-
drb
-
Reporter: sourceforgetracker
-
September 21, 2009
-
0
-
Watchers: 0
-
September 22, 2009
-
September 22, 2009
Description
Loading any configuration file from a jar fails in the current beta release and CVS head.
Error details: net.sf.ehcache.CacheException: Error configuring from jar:file:/C:/documents and settings/jt/LOCALS~1/Temp/config_29212.jar!/ehcache.xml. Error was file:\C:\documents and settings\jt\LOCALS~1\Temp\config_29212.jar!\ehcache.xml (The filename, directory name, or volume label syntax is incorrect) at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:120) at net.sf.ehcache.config.ConfigurationFactoryTest.testDefaultConfiguration(ConfigurationFactoryTest.java:561) at net.sf.ehcache.config.ConfigurationFactoryTest.testLoadConfigurationFromJarURL(ConfigurationFactoryTest.java:617)
This is regression caused by the fix applied for bug 1237017: “Fails to load ehcache.xml if the filepath contains spaces” - it now tries to convert all urls to a file path and load from that path, which will only work for files - not for jars, http or any other protocol.
The fix is to simply use the URL.openStream() method.
Note that this fix will invalidate bug 1338846: “URLdecode for url.getFile”.
The attached patch fixes the issue and includes a test case to prevent regression. Sourceforge Ticket ID: 1410374 - Opened By: teljj001 - 20 Jan 2006 02:05 UTC
Re-opening so that I can properly close out these issues and have correct Resolution status in Jira