From 0e8ed9ab0cce69f3da7180de2e1c8162258cca60 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 10 Dec 2019 14:19:04 +0300 Subject: [PATCH] fix test under Linux when findChild(name with backslashes) was returning null but shouldn't have (IDEA-CR-56333) GitOrigin-RevId: c3d94e461bf5b30146e19510a8f3e57d1a0a127f --- .../vfs/newvfs/impl/VirtualDirectoryImpl.java | 3 ++- .../openapi/vfs/local/JarFileSystemTest.java | 13 ------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java index 91d6c09b7253..5bda1335142b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java @@ -36,6 +36,7 @@ import one.util.streamex.StreamEx; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -216,7 +217,7 @@ public class VirtualDirectoryImpl extends VirtualFileSystemEntry { } private static boolean isFileSeparator(char c) { - return c == '/' || c=='\\'; + return c == '/' || c == File.separatorChar; } @NotNull diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/JarFileSystemTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/JarFileSystemTest.java index 0ff5987c8257..c1938817d9ac 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/JarFileSystemTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/JarFileSystemTest.java @@ -19,7 +19,6 @@ import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem; import com.intellij.openapi.vfs.newvfs.BulkFileListener; import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent; import com.intellij.openapi.vfs.newvfs.events.VFileEvent; -import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.fixtures.BareTestFixtureTestCase; import com.intellij.testFramework.rules.TempDirectory; @@ -33,7 +32,6 @@ import java.io.*; import java.lang.reflect.Field; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.concurrent.CountDownLatch; @@ -41,7 +39,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.jar.JarFile; -import java.util.zip.ZipFile; import static com.intellij.openapi.util.io.IoTestUtil.assertTimestampsEqual; import static com.intellij.testFramework.PlatformTestUtil.assertPathsEqual; @@ -258,16 +255,6 @@ public class JarFileSystemTest extends BareTestFixtureTestCase { else { assertNull(JarFileSystem.getInstance().findFileByPath(jarPath + JarFileSystem.JAR_SEPARATOR + crazyDir.replace('\\', '/') + crazyEntry)); VirtualFile dir = jarRoot.findChild(crazyDir); - LOG.debug(jarRoot + " children: " + Arrays.toString(jarRoot.getChildren())); - LOG.debug(" exist child: " + ContainerUtil.exists(jarRoot.getChildren(), c->c.getName().equals(crazyDir))); - LOG.debug(" persist children: " + Arrays.toString(PersistentFS.getInstance().listAll(jarRoot))); - - try (ZipFile file = new ZipFile(jarPath)) { - LOG.debug("Entries: " + ContainerUtil.toList(file.entries())); - } - catch (IOException e) { - throw new RuntimeException(e); - } assertNotNull(dir); assertNotNull(dir.findChild(crazyEntry)); }