2626package jdk .jfr .internal .consumer ;
2727
2828import java .io .IOException ;
29+ import java .nio .file .DirectoryIteratorException ;
2930import java .nio .file .DirectoryStream ;
3031import java .nio .file .Path ;
3132import java .nio .file .attribute .FileTime ;
@@ -100,12 +101,11 @@ private boolean updatePaths(boolean wait) {
100101 if (updatePaths ()) {
101102 break ;
102103 }
103- } catch (IOException e ) {
104- Logger .log (LogTag .JFR_SYSTEM_STREAMING , LogLevel .DEBUG , "IOException during repository file scan " + e .getMessage ());
104+ } catch (IOException | DirectoryIteratorException e ) {
105+ Logger .log (LogTag .JFR_SYSTEM_STREAMING , LogLevel .DEBUG , "Exception during repository file scan " + e .getMessage ());
105106 // This can happen if a chunk is being removed
106107 // between the file was discovered and an instance
107- // was accessed, or if new file has been written yet
108- // Just ignore, and retry later.
108+ // was accessed. Just ignore, and retry later.
109109 }
110110 if (wait ) {
111111 nap ();
@@ -131,7 +131,7 @@ public Path nextPath(long startTimeNanos, boolean wait) {
131131 // Update paths
132132 try {
133133 updatePaths ();
134- } catch (IOException e ) {
134+ } catch (IOException | DirectoryIteratorException e ) {
135135 // ignore
136136 }
137137 // try to get the next file
@@ -167,7 +167,7 @@ private void nap() {
167167 }
168168 }
169169
170- private boolean updatePaths () throws IOException {
170+ private boolean updatePaths () throws IOException , DirectoryIteratorException {
171171 boolean foundNew = false ;
172172 Path repoPath = repository ;
173173
@@ -254,7 +254,7 @@ private Path findSubDirectory(Path repoPath) {
254254 }
255255 }
256256 }
257- } catch (IOException e ) {
257+ } catch (IOException | DirectoryIteratorException e ) {
258258 // Ignore
259259 }
260260 return latestPath ;
0 commit comments