提交 e1ce3821 编写于 作者: A alanb

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

Reviewed-by: forax, chegar
上级 33bb7b5d
...@@ -92,7 +92,7 @@ class FileTreeWalker { ...@@ -92,7 +92,7 @@ class FileTreeWalker {
(System.getSecurityManager() == null)) (System.getSecurityManager() == null))
{ {
BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get(); BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get();
if (!followLinks || !cached.isSymbolicLink()) if (cached != null && (!followLinks || !cached.isSymbolicLink()))
attrs = cached; attrs = cached;
} }
IOException exc = null; IOException exc = null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册