From f4cd919eae73bc2cd25675619a80840994afce6c Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Wed, 16 May 2018 15:26:01 +0300 Subject: [PATCH] External system api: avoid calling getPath() when watched files changed (IDEA-190829) --- .../autoimport/ExternalSystemProjectsWatcherImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java index 6fab93d964c5..b7d1f9129c77 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java @@ -41,6 +41,7 @@ import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.*; import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent; import com.intellij.openapi.vfs.newvfs.events.VFileEvent; @@ -551,9 +552,10 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific protected boolean isRelevant(String path) { if (!myKnownFiles.get(path).isEmpty()) return true; + String canonicalPath = FileUtil.toCanonicalPath(path); for (VirtualFilePointer pointer : myFilesPointers.keySet()) { - VirtualFile f = pointer.getFile(); - if (f != null && FileUtil.pathsEqual(path, f.getPath())) { + String filePath = VfsUtilCore.urlToPath(pointer.getUrl()); + if (StringUtil.isNotEmpty(filePath) && FileUtil.namesEqual(canonicalPath, FileUtil.toCanonicalPath(filePath))) { for (String projectPath : myFilesPointers.get(pointer)) { myKnownFiles.putValue(path, projectPath); myKnownAffectedFiles.putValue(projectPath, path);