[jboss-cvs] JBossAS SVN: r97706 - in projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs: spi and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 10 14:55:53 EST 2009
Author: johnbailey
Date: 2009-12-10 14:55:53 -0500 (Thu, 10 Dec 2009)
New Revision: 97706
Modified:
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java
projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java
Log:
Additional fix in JavaZipFileSystem to correctly handle directory names
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java 2009-12-10 19:30:34 UTC (rev 97705)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/VFSUtils.java 2009-12-10 19:55:53 UTC (rev 97706)
@@ -694,7 +694,7 @@
/**
- * Determine the relative path within the assembly.
+ * Determine the relative path between a root and a target.
*
* @param mountPoint
* @param target
@@ -707,6 +707,24 @@
}
/**
+ * Determine the relative path between a root and a target as a string.
+ *
+ * @param mountPoint
+ * @param target
+ * @return
+ */
+ public static String getRelativePathString(VirtualFile mountPoint, VirtualFile target) {
+ List<String> pathParts = getRelativePath(mountPoint, target);
+ if(!pathParts.isEmpty()) {
+ return PathTokenizer.getRemainingPath(pathParts, 0);
+ } else {
+ return "";
+ }
+ }
+
+
+
+ /**
* Recursively work from the target to the mount-point and collect the path elements.
*
* @param mountPoint
Modified: projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java
===================================================================
--- projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java 2009-12-10 19:30:34 UTC (rev 97705)
+++ projects/vfs/branches/dml-zip-rework/src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java 2009-12-10 19:55:53 UTC (rev 97706)
@@ -146,18 +146,16 @@
if (cachedFile != null) {
return cachedFile;
}
- // nope, create a cached temp
- cachedFile = buildFile(contentsDir, zipNode.name);
- if(zipNode.entry != null)
- {
- final JarEntry zipEntry = getNodeEntry(zipNode);
+ // nope, create a cached temp
+ final JarEntry zipEntry = zipNode.entry;
+ String name = VFSUtils.getRelativePathString(mountPoint, target);
+ cachedFile = buildFile(contentsDir, name);
+ if(zipEntry == null) {
+ cachedFile.mkdir();
+ } else {
VFSUtils.copyStreamAndClose(zipFile.getInputStream(zipEntry), new BufferedOutputStream(new FileOutputStream(cachedFile)));
}
- else if(cachedFile.exists() == false)
- {
- cachedFile.mkdir();
- }
zipNode.cachedFile = cachedFile;
return cachedFile;
More information about the jboss-cvs-commits
mailing list