8213429: Windows file handling redux
Reviewed-by: alanb, dfuchs, weijun, bpb, rhalade, ahgross
This commit is contained in:
parent
e287fa90a8
commit
12bf1b15ab
@ -367,12 +367,22 @@ public final class FilePermission extends Permission implements Serializable {
|
||||
this.mask = mask;
|
||||
|
||||
if (cpath.equals("<<ALL FILES>>")) {
|
||||
allFiles = true;
|
||||
directory = true;
|
||||
recursive = true;
|
||||
cpath = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate path by platform's default file system
|
||||
try {
|
||||
String name = cpath.endsWith("*") ? cpath.substring(0, cpath.length() - 1) + "-" : cpath;
|
||||
builtInFS.getPath(new File(name).getPath());
|
||||
} catch (InvalidPathException ipe) {
|
||||
invalid = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// store only the canonical cpath if possible
|
||||
cpath = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
@ -576,19 +586,19 @@ public final class FilePermission extends Permission implements Serializable {
|
||||
* @return the effective mask
|
||||
*/
|
||||
boolean impliesIgnoreMask(FilePermission that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (allFiles) {
|
||||
return true;
|
||||
}
|
||||
if (this.invalid || that.invalid) {
|
||||
return false;
|
||||
}
|
||||
if (that.allFiles) {
|
||||
return false;
|
||||
}
|
||||
if (FilePermCompat.nb) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (allFiles) {
|
||||
return true;
|
||||
}
|
||||
if (this.invalid || that.invalid) {
|
||||
return false;
|
||||
}
|
||||
if (that.allFiles) {
|
||||
return false;
|
||||
}
|
||||
// Left at least same level of wildness as right
|
||||
if ((this.recursive && that.recursive) != that.recursive
|
||||
|| (this.directory && that.directory) != that.directory) {
|
||||
@ -786,10 +796,10 @@ public final class FilePermission extends Permission implements Serializable {
|
||||
|
||||
FilePermission that = (FilePermission) obj;
|
||||
|
||||
if (this.invalid || that.invalid) {
|
||||
return false;
|
||||
}
|
||||
if (FilePermCompat.nb) {
|
||||
if (this.invalid || that.invalid) {
|
||||
return false;
|
||||
}
|
||||
return (this.mask == that.mask) &&
|
||||
(this.allFiles == that.allFiles) &&
|
||||
this.npath.equals(that.npath) &&
|
||||
@ -798,6 +808,7 @@ public final class FilePermission extends Permission implements Serializable {
|
||||
(this.recursive == that.recursive);
|
||||
} else {
|
||||
return (this.mask == that.mask) &&
|
||||
(this.allFiles == that.allFiles) &&
|
||||
this.cpath.equals(that.cpath) &&
|
||||
(this.directory == that.directory) &&
|
||||
(this.recursive == that.recursive);
|
||||
|
Loading…
x
Reference in New Issue
Block a user