提交 54b26037 编写于 作者: A aeubanks

8229899: Make java.io.File.isInvalid() less racy

Reviewed-by: alanb, martin, shade
上级 c03f0ca7
...@@ -183,11 +183,13 @@ public class File ...@@ -183,11 +183,13 @@ public class File
* @return true if the file path is invalid. * @return true if the file path is invalid.
*/ */
final boolean isInvalid() { final boolean isInvalid() {
if (status == null) { PathStatus s = status;
status = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED if (s == null) {
s = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED
: PathStatus.INVALID; : PathStatus.INVALID;
status = s;
} }
return status == PathStatus.INVALID; return s == PathStatus.INVALID;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册