diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/VfsEventGenerationHelper.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/VfsEventGenerationHelper.java index 92d97b15e3ba..499201c1a01d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/VfsEventGenerationHelper.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/VfsEventGenerationHelper.java @@ -64,14 +64,19 @@ class VfsEventGenerationHelper { if (LOG.isTraceEnabled()) LOG.trace("create parent=" + parent + " name=" + childName + " attr=" + attributes); ChildInfo[] children = null; if (attributes.isDirectory() && parent.getFileSystem() instanceof LocalFileSystem && !attributes.isSymLink()) { - Path child = Paths.get(parent.getPath(), childName); - if (shouldScanDirectory(parent, child, childName)) { - Path[] relevantExcluded = ContainerUtil.mapNotNull(ProjectManagerEx.getInstanceEx().getAllExcludedUrls(), - url -> { - Path path = Paths.get(VirtualFileManager.extractPath(url)); - return path.startsWith(child) ? path : null; - }, new Path[0]); - children = scanChildren(child, relevantExcluded, checkCanceled); + try { + Path child = Paths.get(parent.getPath(), childName); + if (shouldScanDirectory(parent, child, childName)) { + Path[] relevantExcluded = ContainerUtil.mapNotNull(ProjectManagerEx.getInstanceEx().getAllExcludedUrls(), + url -> { + Path path = Paths.get(VirtualFileManager.extractPath(url)); + return path.startsWith(child) ? path : null; + }, new Path[0]); + children = scanChildren(child, relevantExcluded, checkCanceled); + } + } + catch (InvalidPathException ignored) { + // Paths.get() throws sometimes } } VFileCreateEvent event = new VFileCreateEvent(null, parent, childName, attributes.isDirectory(), attributes, symlinkTarget, true,