IDEA-167037 The assertion "File accessed outside allowed root" is triggered by files symlinked from the the JDK installation folder

This commit is contained in:
Alexey Kudravtsev
2017-03-20 13:40:46 +03:00
parent 0f40c5d1bc
commit 74893feb9f
@@ -73,12 +73,7 @@ public class VfsRootAccess {
return;
}
Set<String> allowed = ApplicationManager.getApplication().runReadAction(new Computable<Set<String>>() {
@Override
public Set<String> compute() {
return allowedRoots();
}
});
Set<String> allowed = ApplicationManager.getApplication().runReadAction((Computable<Set<String>>)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