Better usage of Paths vs File API.

This commit is contained in:
Chris Rankin 2017-02-06 18:10:37 +00:00
parent 455cdba5d9
commit 7ea2dbdd77
2 changed files with 6 additions and 5 deletions

View File

@ -1,9 +1,10 @@
package net.corda.demobench.config;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.LogManager;
/**
@ -24,8 +25,8 @@ public class LoggingConfig {
ClassLoader classLoader = LoggingConfig.class.getClassLoader();
InputStream input = classLoader.getResourceAsStream("logging.properties");
if (input == null) {
File javaHome = new File(System.getProperty("java.home"));
input = new FileInputStream(new File(new File(javaHome, "lib"), "logging.properties"));
Path javaHome = Paths.get(System.getProperty("java.home"));
input = Files.newInputStream(javaHome.resolve("lib").resolve("logging.properties"));
}
return input;
}

View File

@ -84,7 +84,7 @@ class NodeController : Controller() {
confFile.writeText(fileData.root().render(renderOptions))
// Nodes cannot issue cash unless they contain the "Bank of Corda" plugin.
if (config.isCashIssuer && bankOfCorda.isFile()) {
if (config.isCashIssuer && bankOfCorda.isFile) {
log.info("Installing 'Bank of Corda' plugin")
bankOfCorda.copyTo(nodeDir.resolve("plugins").resolve(bankOfCorda.name))
}