< prev index next >
src/java.base/share/classes/java/io/File.java
Print this page
rev 56147 : 8229899: Make java.io.File.isInvalid() less racy
@@ -180,15 +180,17 @@
* returning false does not guarantee that the path is valid.
*
* @return true if the file path is invalid.
*/
final boolean isInvalid() {
- if (status == null) {
- status = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED
- : PathStatus.INVALID;
+ PathStatus s = status;
+ if (s == null) {
+ s = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED
+ : PathStatus.INVALID;
+ status = s;
}
- return status == PathStatus.INVALID;
+ return s == PathStatus.INVALID;
}
/**
* The length of this abstract pathname's prefix, or zero if it has no
* prefix.
< prev index next >