don't throw InvalidVirtualFileAccessException from refreshAndFindFileByPath

GitOrigin-RevId: fecb42a47d5f0e0b3c2f35663b8eeb9e39f07a8b
This commit is contained in:
peter
2019-09-05 05:59:45 +00:00
committed by intellij-monorepo-bot
parent afc89639cf
commit 501c21024d
@@ -106,7 +106,7 @@ public class VirtualDirectoryImpl extends VirtualFileSystemEntry {
return null;
}
if (!isValid()) {
throw new InvalidVirtualFileAccessException(this);
return handleInvalidDirectory();
}
VirtualFileSystemEntry found = doFindChildInArray(name, caseSensitive);
@@ -170,6 +170,15 @@ public class VirtualDirectoryImpl extends VirtualFileSystemEntry {
return child;
}
private VirtualFileSystemEntry handleInvalidDirectory() {
if (!ApplicationManager.getApplication().isReadAccessAllowed()) {
// We can be inside refreshAndFindFileByPath, which must be called outside read action, and
// throwing an exception doesn't seem a good idea when the callers can't do anything about it
return null;
}
throw new InvalidVirtualFileAccessException(this);
}
// removes forward/back slashes from start/end and return trimmed name or null if there are slashes in the middle or it's empty
private static String deSlash(@NotNull String name) {
int startTrimmed = -1;