Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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