diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTUtils.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTUtils.java index 1fe6da2aaa..79af99704f 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTUtils.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTUtils.java @@ -19,6 +19,7 @@ import java.io.File; import java.io.IOException; +import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.FileSystem; @@ -1855,14 +1856,24 @@ public static ICompilationUnit getWorkingCopy(IClassFile classFile, String conte } public static boolean isExcludedFile(List patterns, String uriString) { + if (patterns.isEmpty()) { + return false; + } + URI uri = toURI(uriString); if (uri == null) { return false; } - java.nio.file.Path path = Paths.get(uri); - FileSystem fileSystems = path.getFileSystem(); - return !patterns.stream().filter(pattern -> fileSystems.getPathMatcher("glob:" + pattern).matches(path)).collect(Collectors.toList()).isEmpty(); + // https://github.com/redhat-developer/vscode-java/issues/3735 + java.nio.file.Path[] path = new java.nio.file.Path[1]; + try { + path[0] = Paths.get(uri.toURL().getPath()); + } catch (MalformedURLException e) { + path[0] = Paths.get(uri); + } + FileSystem fileSystems = path[0].getFileSystem(); + return !patterns.stream().filter(pattern -> fileSystems.getPathMatcher("glob:" + pattern).matches(path[0])).collect(Collectors.toList()).isEmpty(); } /**