EHC ❯ Cannot create a DiskStore on a Windows share
-
Bug
-
Status: Open
-
2 Major
-
Resolution:
-
ehcache-core
-
-
-
Reporter:
-
January 18, 2010
-
0
-
Watchers: 1
-
October 11, 2011
-
Description
I investigated the reason of thrown exception “Could not create cache directory…”. Found that computer uses network harddrive, so path USER_HOME begins with double separators like “\local.aaa.bbb\Home\profiles...”. But ehcache replaces double separators with single separator at net.sf.ehcache.config.DiskStoreConfiguration.translatePath(String path) .
The method in question is:
private static String translatePath(String path) { String translatedPath = replaceToken(Env.USER_HOME, System.getProperty(Env.USER_HOME), path); translatedPath = replaceToken(Env.USER_DIR, System.getProperty(Env.USER_DIR), translatedPath); translatedPath = replaceToken(Env.JAVA_IO_TMPDIR, System.getProperty(Env.JAVA_IO_TMPDIR), translatedPath); translatedPath = replaceToken(Env.EHCACHE_DISK_STORE_DIR, System.getProperty(Env.EHCACHE_DISK_STORE_DIR), translatedPath); //Remove duplicate separators: Windows and Solaris translatedPath = replaceToken(File.separator + File.separator, File.separator, translatedPath); LOG.debug(“Disk Store Path: “ + translatedPath); return translatedPath; }
The replaceToken(File.separator + File.separator, File.separator, translatedPath); line is there for a reason. When fixing this bug, testing should be done on Windows, Solaris and Linux with various paths e.g. c:\tmp c:\tmp \computer\share etc.
Comments
Fiona OShea 2010-09-01
Fiona OShea 2011-02-22
MOving unresolved P2 jiras to Ulloa - to be reviewed by Chris, Fiona, Greg soon
Moving all unresolved “Fix Revision 2.2.1” to fix revision “unknown” as we are releasing Magnum first which is 2.3. Currently not sure which fix version these will actually be in, but they are targeted for Fremantle release