From 5fa281c0ee35ebe6f734d3fd095a6e76b39d0855 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 6 Jan 2012 15:00:22 +0000 Subject: [PATCH] 7127235: (fs) NPE in Files.walkFileTree if cached attributes are GC'ed Reviewed-by: forax, chegar --- jdk/src/share/classes/java/nio/file/FileTreeWalker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/java/nio/file/FileTreeWalker.java b/jdk/src/share/classes/java/nio/file/FileTreeWalker.java index 6e1a83ff16f..7b1f43fe4ac 100644 --- a/jdk/src/share/classes/java/nio/file/FileTreeWalker.java +++ b/jdk/src/share/classes/java/nio/file/FileTreeWalker.java @@ -92,7 +92,7 @@ class FileTreeWalker { (System.getSecurityManager() == null)) { BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get(); - if (!followLinks || !cached.isSymbolicLink()) + if (cached != null && (!followLinks || !cached.isSymbolicLink())) attrs = cached; } IOException exc = null;