Skip to content

Commit

Permalink
8194230: jdk/internal/jrtfs/remote/RemoteRuntimeImageTest.java fails …
Browse files Browse the repository at this point in the history
…with java.lang.NullPointerException

Backport-of: b5f939c
  • Loading branch information
RealCLanger committed Jul 28, 2021
1 parent adcfbd2 commit 57a7e71
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions test/jdk/jdk/internal/jrtfs/remote/RemoteRuntimeImageTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -32,7 +32,6 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand All @@ -55,7 +54,7 @@ public static void main(String[] args) throws Exception {
return;
}

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

private static Path getJdk8Path(String jdk8Home) {
Path jdk8Path = Paths.get(jdk8Home);
// It is possible to point to the path of java executable by ${JT_JAVA}
return Files.isDirectory(jdk8Path)? jdk8Path : jdk8Path.getParent().getParent();
}

private static boolean isJdk8(Path jdk8Home) throws FileNotFoundException, IOException {
File file = jdk8Home.resolve("release").toFile();
private static boolean isJdk8(Path jdk8HomePath) throws IOException {
File releaseFile = jdk8HomePath.resolve("release").toFile();
if (!releaseFile.exists()) {
throw new RuntimeException(releaseFile.getPath() +
" doesn't exist");
}
Properties props = new Properties();
try (FileInputStream in = new FileInputStream(file)) {
try (FileInputStream in = new FileInputStream(releaseFile)) {
props.load(in);
}

Expand Down

1 comment on commit 57a7e71

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.