[
https://jira.jboss.org/jira/browse/JBVFS-129?page=com.atlassian.jira.plug...
]
Matt Drees updated JBVFS-129:
-----------------------------
Attachment: zip-entry-fix-testcase.patch
A testcase showing the problem. In addition to applying the patch, you'll need to
copy src/test/resources/vfs/context/jar/archive.jar to
src/test/resources/vfs/context/dir+with+pluses/archive.jar
ZipEntryContext cannot handle directory paths with '+'
symbols
--------------------------------------------------------------
Key: JBVFS-129
URL:
https://jira.jboss.org/jira/browse/JBVFS-129
Project: JBoss VFS
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 2.2.0.Alpha1
Environment: Apache Maven 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
Java version: 1.6.0_15
OS name: "mac os x" version: "10.5.8" arch: "x86_64"
Family: "mac"
Reporter: Matt Drees
Assignee: Ales Justin
Attachments: zip-entry-fix-testcase.patch
When trying to create/use a ZipEntryContext on a zip file whose absolute path contains
'+' symbols, the createZipSource() throws an exception looking something like:
Caused by: java.lang.RuntimeException: Failed to initialize ZipWrapper:
/var/folders/JG/JGDYgcyPGF8WRpvalJeL0k+++TI/-Tmp-/slsb.jar
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.getZipSource(ZipEntryContext.java:286)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:637)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:783)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChild(ZipEntryContext.java:827)
at
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.createChildHandler(ZipEntryHandler.java:195)
at
org.jboss.virtual.plugins.context.AbstractVirtualFileHandler.structuredFindChild(AbstractVirtualFileHandler.java:690)
at
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChild(ZipEntryHandler.java:169)
at
org.jboss.virtual.plugins.context.DelegatingHandler.getChild(DelegatingHandler.java:107)
at org.jboss.virtual.VirtualFile.getChild(VirtualFile.java:492)
at
org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure.determineStructure(DeclaredStructure.java:64)
... 40 more
Caused by: java.io.FileNotFoundException: /var/folders/JG (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.createZipSource(ZipEntryContext.java:361)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.getZipSource(ZipEntryContext.java:282)
... 49 more
Here's my understanding of the source of the problem, based on some debugging &
research.
ZipEntryContext uses URLDecoder.decode() (via VFSUtils.decode()) to convert a file path
(which may contain quoted characters, e.g. %20) into a path that the single-String-arg
File constructor understands. In the example above, the result is
'/var/folders/JG/JGDYgcyPGF8WRpvalJeL0k TI/-Tmp-/slsb.jar', which is obviously
incorrect.
I think using URLDecoder.decode() is a faulty strategy. I'll attach my suggested
fix.
(This problem would especially cause problems for OS X users, since the OS X temp
directory (always? often?) contains '+++' in its path. This is the case in the
stacktrace above. A workaround for this particular problem is to use
-Djava.io.tmpdir=/some/path/without/pluses)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira