7127235: (fs) NPE in Files.walkFileTree if cached attributes are GC'ed

Reviewed-by: forax, chegar
This commit is contained in:
Alan Bateman 2012-01-06 15:00:22 +00:00
parent d1c86caeaa
commit 5fa281c0ee

View File

@ -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;