< 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,194 ****
* 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;
}
! return status == PathStatus.INVALID;
}
/**
* The length of this abstract pathname's prefix, or zero if it has no
* prefix.
--- 180,196 ----
* returning false does not guarantee that the path is valid.
*
* @return true if the file path is invalid.
*/
final boolean isInvalid() {
! PathStatus s = status;
! if (s == null) {
! s = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED
! : PathStatus.INVALID;
! status = s;
}
! return s == PathStatus.INVALID;
}
/**
* The length of this abstract pathname's prefix, or zero if it has no
* prefix.
< prev index next >