Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove toLower call, fix JBVFS-170

  • Loading branch information...
commit 56f01a0e15d4ea5c6bb2d99aaffb01b4641a9e30 1 parent 8483437
@alesj alesj authored
View
1  src/main/java/org/jboss/vfs/VirtualFile.java
@@ -82,6 +82,7 @@ public String getName() {
* Get the simple VF name mapped to lowercase (x.java) (used by case-insensitive filesystems like ZIP).
*
* @return the lowercase simple file name
+ * @deprecated should not be used anymore, as the code is case-sensitive from JBVFS-170
*/
public String getLowerCaseName() {
return lcname;
View
8 src/main/java/org/jboss/vfs/spi/JavaZipFileSystem.java
@@ -55,6 +55,7 @@
* file disappears unexpectedly, the filesystem will malfunction.
*
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
*/
public final class JavaZipFileSystem implements FileSystem {
@@ -114,11 +115,10 @@ public JavaZipFileSystem(File archiveFile, TempDir tempDir) throws IOException {
// todo - log bad zip entry
continue FILES;
}
- final String lcToken = token.toLowerCase();
- ZipNode child = children.get(lcToken);
+ ZipNode child = children.get(token);
if (child == null) {
child = it.hasNext() || isDirectory ? new ZipNode(new HashMap<String, ZipNode>(), token, null) : new ZipNode(null, token, entry);
- children.put(lcToken, child);
+ children.put(token, child);
}
node = child;
}
@@ -339,7 +339,7 @@ private ZipNode find(VirtualFile mountPoint, VirtualFile target) {
if (children == null) {
return null;
}
- return children.get(target.getLowerCaseName());
+ return children.get(target.getName());
}
}
}
View
78 src/test/java/org/jboss/test/vfs/JarVFSUnitTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.vfs;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.vfs.VirtualFile;
+import org.junit.Assert;
+
+/**
+ * Tests of the VFS implementation
+ *
+ * @author ales.justin@jboss.org
+ */
+public class JarVFSUnitTestCase extends AbstractVFSTest
+{
+ public JarVFSUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(JarVFSUnitTestCase.class);
+ }
+
+ public void testDuplicateName() throws Throwable
+ {
+ VirtualFile jar = getVirtualFile("/vfs/test/dup.jar");
+ recursiveMount(jar);
+
+ VirtualFile lower = jar.getChild("org/jboss/acme/Dummy.class");
+ Assert.assertNotNull(lower);
+ Assert.assertTrue(lower.exists());
+ VirtualFile upper = jar.getChild("org/jboss/acme/DuMMy.class");
+ Assert.assertNotNull(upper);
+ Assert.assertTrue(upper.exists());
+ String ll = readLine(lower);
+ String ul = readLine(upper);
+ Assert.assertFalse("Lines match", ll.equals(ul));
+ }
+
+ static String readLine(VirtualFile file) throws Throwable
+ {
+ InputStream is = file.openStream();
+ try
+ {
+ return new BufferedReader(new InputStreamReader(is)).readLine();
+ }
+ finally
+ {
+ is.close();
+ }
+ }
+}
View
BIN  src/test/resources/vfs/test/dup.jar
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.