changeset 4907:400cc379adb5

7127235: (fs) NPE in Files.walkFileTree if cached attributes are GC'ed Reviewed-by: forax, chegar
author alanb
date Fri, 06 Jan 2012 15:00:22 +0000
parents 0194fe5ca404
children e6ef778c1df4
files src/share/classes/java/nio/file/FileTreeWalker.java
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/nio/file/FileTreeWalker.java	Wed Jan 04 03:49:35 2012 -0800
+++ b/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;