From 4ce59695832d2a460c066b24320e6ab3ff733329 Mon Sep 17 00:00:00 2001 From: Snjezana Peco Date: Tue, 1 Oct 2024 03:11:31 +0200 Subject: [PATCH] java.diagnostic.filter is broken on Windows --- .../src/org/eclipse/jdt/ls/core/internal/JDTUtils.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 79af99704f..c1df7fa866 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 @@ -24,6 +24,7 @@ import java.net.URISyntaxException; import java.nio.file.FileSystem; import java.nio.file.Files; +import java.nio.file.InvalidPathException; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; @@ -1869,8 +1870,13 @@ public static boolean isExcludedFile(List patterns, String uriString) { 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); + } catch (MalformedURLException | InvalidPathException e) { + try { + path[0] = Paths.get(uri); + } catch (Exception e1) { + JavaLanguageServerPlugin.logException(e1); + return false; + } } FileSystem fileSystems = path[0].getFileSystem(); return !patterns.stream().filter(pattern -> fileSystems.getPathMatcher("glob:" + pattern).matches(path[0])).collect(Collectors.toList()).isEmpty();