7127235: (fs) NPE in Files.walkFileTree if cached attributes are GC'ed
authoralanb
Fri, 06 Jan 2012 15:00:22 +0000
changeset 11506 905dbb3e77eb
parent 11365 05d995976571
child 11508 fde1714f1745
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
--- a/jdk/src/share/classes/java/nio/file/FileTreeWalker.java	Wed Jan 04 03:49:35 2012 -0800
+++ b/jdk/src/share/classes/java/nio/file/FileTreeWalker.java	Fri Jan 06 15:00:22 2012 +0000
@@ -92,7 +92,7 @@
             (System.getSecurityManager() == null))
         {
             BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get();
-            if (!followLinks || !cached.isSymbolicLink())
+            if (cached != null && (!followLinks || !cached.isSymbolicLink()))
                 attrs = cached;
         }
         IOException exc = null;