< prev index next >
src/java.base/share/classes/java/io/FilePermission.java
Print this page
8213406: (fs) More than one instance of built-in FileSystem observed in heap
Reviewed-by: alanb, cushon, weijun
*** 23,33 ****
* questions.
*/
package java.io;
- import java.net.URI;
import java.nio.file.*;
import java.security.*;
import java.util.Enumeration;
import java.util.Objects;
import java.util.StringJoiner;
--- 23,32 ----
*** 197,212 ****
// }
private static final long serialVersionUID = 7930732926638008763L;
/**
! * Always use the internal default file system, in case it was modified
! * with java.nio.file.spi.DefaultFileSystemProvider.
*/
private static final java.nio.file.FileSystem builtInFS =
! DefaultFileSystemProvider.create()
! .getFileSystem(URI.create("file:///"));
private static final Path here = builtInFS.getPath(
GetPropertyAction.privilegedGetProperty("user.dir"));
private static final Path EMPTY_PATH = builtInFS.getPath("");
--- 196,210 ----
// }
private static final long serialVersionUID = 7930732926638008763L;
/**
! * Always use the builtin system-default file system, in case the
! * java.nio.file.spi.DefaultFileSystemProvider system property is set.
*/
private static final java.nio.file.FileSystem builtInFS =
! DefaultFileSystemProvider.theFileSystem();
private static final Path here = builtInFS.getPath(
GetPropertyAction.privilegedGetProperty("user.dir"));
private static final Path EMPTY_PATH = builtInFS.getPath("");
*** 324,334 ****
this.mask = mask;
if (name.equals("<<ALL FILES>>")) {
allFiles = true;
! npath = builtInFS.getPath("");
// other fields remain default
return;
}
boolean rememberStar = false;
--- 322,332 ----
this.mask = mask;
if (name.equals("<<ALL FILES>>")) {
allFiles = true;
! npath = EMPTY_PATH;
// other fields remain default
return;
}
boolean rememberStar = false;
*** 349,359 ****
directory = true;
recursive = !rememberStar;
npath = npath.getParent();
}
if (npath == null) {
! npath = builtInFS.getPath("");
}
invalid = false;
} catch (InvalidPathException ipe) {
// Still invalid. For compatibility reason, accept it
// but make this permission useless.
--- 347,357 ----
directory = true;
recursive = !rememberStar;
npath = npath.getParent();
}
if (npath == null) {
! npath = EMPTY_PATH;
}
invalid = false;
} catch (InvalidPathException ipe) {
// Still invalid. For compatibility reason, accept it
// but make this permission useless.
< prev index next >