From 4e8e3e59a6c5559c939baabc42b72482b67da6ed Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Fri, 13 Nov 2020 13:30:17 -0800 Subject: [PATCH] Improve error message for https://www.pivotaltracker.com/story/show/175715622 Signed-off-by: Kris De Volder --- .../ide/vscode/commons/util/BasicFileObserver.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/BasicFileObserver.java b/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/BasicFileObserver.java index 29b4a1e91..b44fc880a 100644 --- a/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/BasicFileObserver.java +++ b/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/BasicFileObserver.java @@ -12,6 +12,7 @@ package org.springframework.ide.vscode.commons.util; import java.net.URI; import java.nio.file.FileSystems; +import java.nio.file.Path; import java.nio.file.PathMatcher; import java.nio.file.Paths; import java.util.Arrays; @@ -118,7 +119,7 @@ public class BasicFileObserver implements FileObserver { // keep only URIs for which a matcher succeeds pair.left.stream() - .filter(matcher -> matcher.matches(Paths.get(URI.create(uri)))) + .filter(matcher -> matcher.matches(paths_get(uri))) .findFirst() .isPresent()) .toArray(String[]::new))) @@ -127,4 +128,13 @@ public class BasicFileObserver implements FileObserver { .forEach(superPair -> superPair.left.right.accept(superPair.right)); } + // Added in an attempt to learn what causes: https://www.pivotaltracker.com/story/show/175715622 + private static Path paths_get(String uri) { + try { + return Paths.get(URI.create(uri)); + } catch (IllegalArgumentException e) { + //make the error more specific (reveal the uri string that causes it) + throw new IllegalArgumentException("uri = '"+uri+"'", e); + } + } }