-
Bug
-
Resolution: Done
-
Major
-
1.1.0.Beta4, 1.1.0.CR2
-
Workaround Exists
-
Current implementation of JarFileResourceLoader.getResource depends on the Operating System in which the server is installed. As a result, for a JAR file, it returns a Resource (JarEntryResource) with invalid URL.
Current code:
return new JarEntryResource(jarFile, entry, new URI("jar", "file:" + jarFile.getName() + "!/" + entry.getName(), null).toURL());
This is buggy, because jarFile.getName() call is platform dependent, and the URI constructor encodes the file-path, making the URI invalid in Windows.
For eg. Say the JAR is located in c:/x.jar, then new URI() call above will parse the arguments into "jar:file:c:%5Cx.jar!/org/..." URI format, which is invalid. However, the expected URI needs to be "jar:file:/c:/x.jar!/org/..." irrespective of in which platform the application server is running.
Fix:
- Instead of jarFile.getName(), you need something like new File(jarFile.getName()).toURI().toString(). Please find the attached patch file.
- This may NOT be an isolated case, and hence, if you are using similar logic somewhere else, then those places need similar fixes.