Ignore URI fragment if present before converting to NIO path

Project: http://git-wip-us.apache.org/repos/asf/incubator-netbeans-html4j/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-html4j/commit/e9c2a51f
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-html4j/tree/e9c2a51f
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-html4j/diff/e9c2a51f

Branch: refs/heads/master
Commit: e9c2a51faa30709666e719bbcddff78840d2ef1a
Parents: 346937f
Author: Jaroslav Tulach <[email protected]>
Authored: Thu Mar 9 06:11:49 2017 +0100
Committer: Jaroslav Tulach <[email protected]>
Committed: Fri Sep 8 17:13:55 2017 +0200

----------------------------------------------------------------------
 boot-fx/src/main/java/org/netbeans/html/boot/fx/WatchDir.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-netbeans-html4j/blob/e9c2a51f/boot-fx/src/main/java/org/netbeans/html/boot/fx/WatchDir.java
----------------------------------------------------------------------
diff --git a/boot-fx/src/main/java/org/netbeans/html/boot/fx/WatchDir.java 
b/boot-fx/src/main/java/org/netbeans/html/boot/fx/WatchDir.java
index 25cc5f2..597b882 100644
--- a/boot-fx/src/main/java/org/netbeans/html/boot/fx/WatchDir.java
+++ b/boot-fx/src/main/java/org/netbeans/html/boot/fx/WatchDir.java
@@ -68,7 +68,11 @@ final class WatchDir implements Runnable {
     private final WebEngine engine;
     
     WatchDir(WebEngine eng) throws URISyntaxException, IOException {
-        dir = Paths.get(new URI(eng.getLocation())).getParent();
+        URI loc = new URI(eng.getLocation());
+        if (loc.getFragment() != null) {
+            loc = new URI(loc.getScheme(), loc.getHost(), loc.getPath(), null);
+        }
+        dir = Paths.get(loc).getParent();
         engine = eng;
         ws = dir.getFileSystem().newWatchService();
         key = dir.register(ws, 

Reply via email to