diff -r b38c7a822244 -r f5f590eaecf5 src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java Fri Aug 02 20:04:02 2019 +0200 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java Fri Aug 02 20:05:23 2019 +0200 @@ -44,15 +44,16 @@ import jdk.jfr.internal.LogTag; import jdk.jfr.internal.Logger; import jdk.jfr.internal.Repository; +import jdk.jfr.internal.SecuritySupport.SafePath; public final class RepositoryFiles { - private final Path repostory; + private final Path repository; private final NavigableMap pathSet = new TreeMap<>(); private final Map pathLookup = new HashMap<>(); private volatile boolean closed; - public RepositoryFiles(Path repostory) { - this.repostory = repostory; + public RepositoryFiles(SafePath repository) { + this.repository = repository.toPath(); } public long getTimestamp(Path p) { @@ -71,14 +72,17 @@ return e.getValue(); } } - SortedMap after = pathSet.tailMap(startTimeNanos); - if (!after.isEmpty()) { - Path path = after.get(after.firstKey()); - Logger.log(LogTag.JFR_SYSTEM_STREAMING, LogLevel.TRACE, "Return path " + path + " for start time nanos " + startTimeNanos); - return path; + Long f = pathSet.floorKey(startTimeNanos); + if (f != null) { + SortedMap after = pathSet.tailMap(f); + if (!after.isEmpty()) { + Path path = after.get(after.firstKey()); + Logger.log(LogTag.JFR_SYSTEM_STREAMING, LogLevel.TRACE, "Return path " + path + " for start time nanos " + startTimeNanos); + return path; + } } try { - if (updatePaths(repostory)) { + if (updatePaths(repository)) { continue; } } catch (IOException e) {