@@ -258,6 +258,15 @@ private FileAccessTree(FilesEntitlement filesEntitlement, PathLookup pathLookup,
258258 this .exclusivePaths = sortedExclusivePaths ;
259259 this .readPaths = pruneSortedPaths (readPaths ).toArray (new String [0 ]);
260260 this .writePaths = pruneSortedPaths (writePaths ).toArray (new String [0 ]);
261+
262+ logger .debug (
263+ () -> Strings .format (
264+ "Created FileAccessTree with paths: exclusive [%s], read [%s], write [%s]" ,
265+ String .join ("," , this .exclusivePaths ),
266+ String .join ("," , this .readPaths ),
267+ String .join ("," , this .writePaths )
268+ )
269+ );
261270 }
262271
263272 // package private for testing
@@ -305,11 +314,17 @@ public static FileAccessTree withoutExclusivePaths(
305314 }
306315
307316 public boolean canRead (Path path ) {
308- return checkPath (normalizePath (path ), readPaths );
317+ var normalizedPath = normalizePath (path );
318+ var canRead = checkPath (normalizedPath , readPaths );
319+ logger .trace (() -> Strings .format ("checking [%s] (normalized to [%s]) for read: %b" , path , normalizedPath , canRead ));
320+ return canRead ;
309321 }
310322
311323 public boolean canWrite (Path path ) {
312- return checkPath (normalizePath (path ), writePaths );
324+ var normalizedPath = normalizePath (path );
325+ var canWrite = checkPath (normalizedPath , writePaths );
326+ logger .trace (() -> Strings .format ("checking [%s] (normalized to [%s]) for write: %b" , path , normalizedPath , canWrite ));
327+ return canWrite ;
313328 }
314329
315330 /**
@@ -327,7 +342,6 @@ static String normalizePath(Path path) {
327342 }
328343
329344 private boolean checkPath (String path , String [] paths ) {
330- logger .trace (() -> Strings .format ("checking [%s] against [%s]" , path , String .join ("," , paths )));
331345 if (paths .length == 0 ) {
332346 return false ;
333347 }
@@ -345,8 +359,9 @@ private boolean checkPath(String path, String[] paths) {
345359 }
346360
347361 private static boolean isParent (String maybeParent , String path ) {
348- logger .trace (() -> Strings .format ("checking isParent [%s] for [%s]" , maybeParent , path ));
349- return path .startsWith (maybeParent ) && path .startsWith (FILE_SEPARATOR , maybeParent .length ());
362+ var isParent = path .startsWith (maybeParent ) && path .startsWith (FILE_SEPARATOR , maybeParent .length ());
363+ logger .trace (() -> Strings .format ("checking isParent [%s] for [%s]: %b" , maybeParent , path , isParent ));
364+ return isParent ;
350365 }
351366
352367 @ Override
0 commit comments