EA-54384 (append .jar separator if missing)
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Fri, 10 Oct 2014 08:38:37 +0000 (10:38 +0200)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Fri, 10 Oct 2014 08:38:37 +0000 (10:38 +0200)
platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarFileSystemImpl.java
platform/platform-tests/testSrc/com/intellij/openapi/vfs/VfsUtilTest.java

index 5bba2f995057f44a386a5d0f9ebf3214be6045f6..819c0b73d84a5f13af937759ff44c6a7a8071d46 100644 (file)
@@ -122,6 +122,7 @@ public class JarFileSystemImpl extends JarFileSystem {
 
   @Override
   public VirtualFile findFileByPath(@NotNull String path) {
+    if (!path.contains(JAR_SEPARATOR)) path += JAR_SEPARATOR;
     return VfsImplUtil.findFileByPath(this, path);
   }
 
index 0acabe1288bb44e9121ca546dc198d3f091f65b8..fe223ea93c732ca74f3f8c2bf2cb0e201d9ef02d 100644 (file)
@@ -107,9 +107,18 @@ public class VfsUtilTest extends PlatformLangTestCase {
 
     File file2 = new File(file1, "test.zip");
     URL url2 = file2.toURI().toURL();
-    url2 = new URL("jar", "", url2.toExternalForm() + "!/");
+
+    url2 = new URL("jar", "", url2.toExternalForm());
+    file0 = VfsUtil.findFileByURL(url2);
+    assertNotNull(file0);
+    assertTrue(file0.isDirectory());
+
+    url2 = new URL(url2.toExternalForm() + "!/");
+    file0 = VfsUtil.findFileByURL(url2);
+    assertNotNull(file0);
+    assertTrue(file0.isDirectory());
+
     url2 = new URL(url2, "com/intellij/installer");
-    url2 = new URL(url2.toExternalForm());
     file0 = VfsUtil.findFileByURL(url2);
     assertNotNull(file0);
     assertTrue(file0.isDirectory());