< prev index next >
src/java.base/share/classes/jdk/internal/loader/BootLoader.java
Print this page
*** 30,40 ****
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
- import java.nio.file.Paths;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Optional;
--- 30,39 ----
*** 241,252 ****
if (location.startsWith("jrt:/")) {
// named module in runtime image ("jrt:/".length() == 5)
mn = location.substring(5, location.length());
} else if (location.startsWith("file:/")) {
// named module in exploded image
! Path path = Paths.get(URI.create(location));
! Path modulesDir = Paths.get(JAVA_HOME, "modules");
if (path.startsWith(modulesDir)) {
mn = path.getFileName().toString();
}
}
--- 240,251 ----
if (location.startsWith("jrt:/")) {
// named module in runtime image ("jrt:/".length() == 5)
mn = location.substring(5, location.length());
} else if (location.startsWith("file:/")) {
// named module in exploded image
! Path path = Path.get(URI.create(location));
! Path modulesDir = Path.get(JAVA_HOME, "modules");
if (path.startsWith(modulesDir)) {
mn = path.getFileName().toString();
}
}
*** 265,275 ****
* Returns URL if the given location is a regular file path.
*/
private static URL toFileURL(String location) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
public URL run() {
! Path path = Paths.get(location);
if (Files.isRegularFile(path)) {
try {
return path.toUri().toURL();
} catch (MalformedURLException e) {}
}
--- 264,274 ----
* Returns URL if the given location is a regular file path.
*/
private static URL toFileURL(String location) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
public URL run() {
! Path path = Path.get(location);
if (Files.isRegularFile(path)) {
try {
return path.toUri().toURL();
} catch (MalformedURLException e) {}
}
*** 283,293 ****
* containing a manifest.
*/
private static Manifest getManifest(String location) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
public Manifest run() {
! Path jar = Paths.get(location);
try (InputStream in = Files.newInputStream(jar);
JarInputStream jis = new JarInputStream(in, false)) {
return jis.getManifest();
} catch (IOException e) {
return null;
--- 282,292 ----
* containing a manifest.
*/
private static Manifest getManifest(String location) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
public Manifest run() {
! Path jar = Path.get(location);
try (InputStream in = Files.newInputStream(jar);
JarInputStream jis = new JarInputStream(in, false)) {
return jis.getManifest();
} catch (IOException e) {
return null;
< prev index next >