From 74893feb9fa24b56b13d5d55f292897a57cb771b Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 17 Mar 2017 18:42:40 +0300 Subject: [PATCH] IDEA-167037 The assertion "File accessed outside allowed root" is triggered by files symlinked from the the JDK installation folder --- .../openapi/vfs/newvfs/impl/VfsRootAccess.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VfsRootAccess.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VfsRootAccess.java index 264201570bce..c36ff7784bfd 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VfsRootAccess.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VfsRootAccess.java @@ -73,12 +73,7 @@ public class VfsRootAccess { return; } - Set allowed = ApplicationManager.getApplication().runReadAction(new Computable>() { - @Override - public Set compute() { - return allowedRoots(); - } - }); + Set allowed = ApplicationManager.getApplication().runReadAction((Computable>)VfsRootAccess::allowedRoots); boolean isUnder = allowed == null || allowed.isEmpty(); if (!isUnder) { @@ -141,6 +136,9 @@ public class VfsRootAccess { allowed.add(FileUtil.toSystemIndependentName(System.getProperty("java.io.tmpdir"))); allowed.add(FileUtil.toSystemIndependentName(SystemProperties.getUserHome())); + allowed.add("/etc"); // After recent update of Oracle JDK 1.8 under Ubuntu Certain files in the JDK installation are symlinked to /etc + // see IDEA-167037 The assertion "File accessed outside allowed root" is triggered by files symlinked from the the JDK installation folder + for (final Project project : openProjects) { if (!project.isInitialized()) { return null; // all is allowed @@ -178,12 +176,7 @@ public class VfsRootAccess { public static void allowRootAccess(@NotNull Disposable disposable, @NotNull final String... roots) { if (roots.length == 0) return; allowRootAccess(roots); - Disposer.register(disposable, new Disposable() { - @Override - public void dispose() { - disallowRootAccess(roots); - } - }); + Disposer.register(disposable, () -> disallowRootAccess(roots)); } @TestOnly