Skip to content

Commit 57a7e71

Browse files
committed
8194230: jdk/internal/jrtfs/remote/RemoteRuntimeImageTest.java fails with java.lang.NullPointerException
Backport-of: b5f939c
1 parent adcfbd2 commit 57a7e71

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

test/jdk/jdk/internal/jrtfs/remote/RemoteRuntimeImageTest.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
3232
import java.io.FileInputStream;
3333
import java.io.FileNotFoundException;
3434
import java.io.IOException;
35-
import java.nio.file.FileSystems;
3635
import java.nio.file.Files;
3736
import java.nio.file.Path;
3837
import java.nio.file.Paths;
@@ -55,7 +54,7 @@ public static void main(String[] args) throws Exception {
5554
return;
5655
}
5756

58-
Path jdk8Path = getJdk8Path(jdk8Home);
57+
Path jdk8Path = Paths.get(jdk8Home);
5958
if (!isJdk8(jdk8Path)) {
6059
System.err.println("This test is only for JDK 8. Skip testing");
6160
return;
@@ -102,16 +101,14 @@ private static void execCmd(List<String> command){
102101
}
103102
}
104103

105-
private static Path getJdk8Path(String jdk8Home) {
106-
Path jdk8Path = Paths.get(jdk8Home);
107-
// It is possible to point to the path of java executable by ${JT_JAVA}
108-
return Files.isDirectory(jdk8Path)? jdk8Path : jdk8Path.getParent().getParent();
109-
}
110-
111-
private static boolean isJdk8(Path jdk8Home) throws FileNotFoundException, IOException {
112-
File file = jdk8Home.resolve("release").toFile();
104+
private static boolean isJdk8(Path jdk8HomePath) throws IOException {
105+
File releaseFile = jdk8HomePath.resolve("release").toFile();
106+
if (!releaseFile.exists()) {
107+
throw new RuntimeException(releaseFile.getPath() +
108+
" doesn't exist");
109+
}
113110
Properties props = new Properties();
114-
try (FileInputStream in = new FileInputStream(file)) {
111+
try (FileInputStream in = new FileInputStream(releaseFile)) {
115112
props.load(in);
116113
}
117114

0 commit comments

Comments
 (0)