[jboss-cvs] JBossAS SVN: r83848 - in projects/vfs/trunk/src: test/java/org/jboss/test/virtual/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 4 08:28:28 EST 2009
Author: alesj
Date: 2009-02-04 08:28:28 -0500 (Wed, 04 Feb 2009)
New Revision: 83848
Modified:
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTest.java
Log:
Fix '/' bug.
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java 2009-02-04 12:44:53 UTC (rev 83847)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java 2009-02-04 13:28:28 UTC (rev 83848)
@@ -282,28 +282,39 @@
{
if (isTemporary())
{
- StringBuffer buf = new StringBuffer(getProtocol()).append(':');
-
- VFSContext context = getVFSContext();
- String rootString = context.getOptions().get(VFSUtils.OLD_ROOT_STRING);
- if (rootString == null)
+ try
{
- URI rootURI = context.getRootURI();
- rootString = VFSUtils.stripProtocol(rootURI);
- }
+ StringBuffer buf = new StringBuffer(getProtocol()).append(':');
- buf.append(rootString);
- String path = getPathName();
- if (path != null && path.length() > 0)
- {
- if (buf.charAt(buf.length() - 1) != '/')
+ VFSContext context = getVFSContext();
+ String rootString = context.getOptions().get(VFSUtils.OLD_ROOT_STRING);
+ if (rootString == null)
{
+ URI rootURI = context.getRootURI();
+ rootString = VFSUtils.stripProtocol(rootURI);
+ }
+
+ buf.append(rootString);
+ String path = getPathName();
+ if (path != null && path.length() > 0)
+ {
+ if (buf.charAt(buf.length() - 1) != '/')
+ {
+ buf.append('/');
+ }
+ buf.append(path);
+ }
+ if (buf.charAt(buf.length() - 1) != '/' && isLeaf() == false)
+ {
buf.append('/');
}
- buf.append(path);
+
+ vfsUrlCached = new URL(buf.toString());
}
-
- vfsUrlCached = new URL(buf.toString());
+ catch (IOException e)
+ {
+ throw new MalformedURLException(e.getMessage());
+ }
}
else
{
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTest.java 2009-02-04 12:44:53 UTC (rev 83847)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileCleanupUnitTest.java 2009-02-04 13:28:28 UTC (rev 83848)
@@ -282,15 +282,15 @@
VirtualFile ear = root.getChild("level1.zip");
VirtualFile earCopy = modify(ear);
- assertEquals(getProtocol() + urlString + "level1.zip", earCopy.toURL().toExternalForm());
+ assertEquals(getProtocol() + urlString + "level1.zip/", earCopy.toURL().toExternalForm());
VirtualFile l2 = earCopy.getChild("level2.zip");
- assertEquals(getProtocol() + urlString + "level1.zip/level2.zip", l2.toURL().toExternalForm());
+ assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/", l2.toURL().toExternalForm());
VirtualFile l2sub = l2.getChild("test2.txt");
assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/test2.txt", l2sub.toURL().toExternalForm());
VirtualFile l3 = l2.getChild("level3.zip");
- assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/level3.zip", l3.toURL().toExternalForm());
+ assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/level3.zip/", l3.toURL().toExternalForm());
VirtualFile l3sub = l3.getChild("test3.txt");
assertEquals(getProtocol() + urlString + "level1.zip/level2.zip/level3.zip/test3.txt", l3sub.toURL().toExternalForm());
More information about the jboss-cvs-commits
mailing list