From 7ea2dbdd77bbbab31ba3ff97f846c10b358eeb39 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Mon, 6 Feb 2017 18:10:37 +0000 Subject: [PATCH] Better usage of Paths vs File API. --- .../java/net/corda/demobench/config/LoggingConfig.java | 9 +++++---- .../kotlin/net/corda/demobench/model/NodeController.kt | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/demobench/src/main/java/net/corda/demobench/config/LoggingConfig.java b/tools/demobench/src/main/java/net/corda/demobench/config/LoggingConfig.java index 9a1c4cf40c..44e4c4b251 100644 --- a/tools/demobench/src/main/java/net/corda/demobench/config/LoggingConfig.java +++ b/tools/demobench/src/main/java/net/corda/demobench/config/LoggingConfig.java @@ -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; } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt index 6db639e86d..ca2bdfd276 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt @@ -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)) }