mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8229899: Make java.io.File.isInvalid() less racy
Reviewed-by: alanb, martin, shade
This commit is contained in:
parent
c99c1f8d55
commit
916c2e3cf3
1 changed files with 6 additions and 4 deletions
|
@ -182,11 +182,13 @@ public class File
|
|||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue