diff --git a/java/java-impl/src/com/intellij/openapi/vfs/impl/jrt/JrtFileSystem.java b/java/java-impl/src/com/intellij/openapi/vfs/impl/jrt/JrtFileSystem.java index 0701359cb5c5..37af0d931e44 100644 --- a/java/java-impl/src/com/intellij/openapi/vfs/impl/jrt/JrtFileSystem.java +++ b/java/java-impl/src/com/intellij/openapi/vfs/impl/jrt/JrtFileSystem.java @@ -111,7 +111,7 @@ public class JrtFileSystem extends ArchiveFileSystem { protected ArchiveHandler getHandler(@NotNull VirtualFile entryFile) { checkSubscription(); - String homePath = extractLocalPath(extractRootPath(entryFile.getPath())); + String homePath = FileUtil.toSystemIndependentName(extractLocalPath(extractRootPath(entryFile.getPath()))); ArchiveHandler handler = myHandlers.get(homePath); if (handler == null) { handler = isSupported() ? new JrtHandler(homePath) : new JrtHandlerStub(homePath); diff --git a/java/java-tests/testSrc/com/intellij/openapi/vfs/JrtFileSystemTest.java b/java/java-tests/testSrc/com/intellij/openapi/vfs/JrtFileSystemTest.java index b8185dc08456..cfeccfe66388 100644 --- a/java/java-tests/testSrc/com/intellij/openapi/vfs/JrtFileSystemTest.java +++ b/java/java-tests/testSrc/com/intellij/openapi/vfs/JrtFileSystemTest.java @@ -86,7 +86,10 @@ public class JrtFileSystemTest extends BareTestFixtureTestCase { assertThat(Stream.of(dir.getChildren()).map(VirtualFile::getName).collect(Collectors.toList())).containsOnly("pkg1"); assertThat(myRoot.findFileByRelativePath("test/pkg2/Class2.class")).isNull(); - Files.copy(myTestData.resolve("image2"), myTempDir.getRoot().toPath().resolve("lib/modules"), StandardCopyOption.REPLACE_EXISTING); + Path modules = myTempDir.getRoot().toPath().resolve("lib/modules"); + Files.move(modules, myTempDir.getRoot().toPath().resolve("lib/modules.bak")); + Files.copy(myTestData.resolve("image2"), modules, StandardCopyOption.REPLACE_EXISTING); + VirtualFile local = LocalFileSystem.getInstance().findFileByIoFile(myTempDir.getRoot()); assertThat(local).isNotNull(); local.refresh(false, true);