Fix NPE in SafePath JEP-349-branch
authoregahlin
Mon, 05 Aug 2019 19:58:56 +0200
branchJEP-349-branch
changeset 57638 3b41affae2d2
parent 57628 f5f590eaecf5
child 57640 46a77fccd251
Fix NPE in SafePath
src/jdk.jfr/share/classes/jdk/jfr/consumer/EventDirectoryStream.java
src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java
--- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/EventDirectoryStream.java	Fri Aug 02 20:05:23 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/EventDirectoryStream.java	Mon Aug 05 19:58:56 2019 +0200
@@ -59,7 +59,7 @@
 
         public DirectoryStream(AccessControlContext acc, Path p) throws IOException {
             super(acc);
-            repositoryFiles = new RepositoryFiles(new SafePath(p));
+            repositoryFiles = new RepositoryFiles(p == null ? null : new SafePath(p));
         }
 
         @Override
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java	Fri Aug 02 20:05:23 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java	Mon Aug 05 19:58:56 2019 +0200
@@ -53,7 +53,7 @@
     private volatile boolean closed;
 
     public RepositoryFiles(SafePath repository) {
-        this.repository = repository.toPath();
+        this.repository = repository == null ? null : repository.toPath();
     }
 
     public long getTimestamp(Path p) {