aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient-java
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahooinc.com>2022-11-01 13:10:55 +0100
committerTor Brede Vekterli <vekterli@yahooinc.com>2022-11-01 13:11:34 +0100
commit7e012aefa5d990036e7296b356d164f87bb4069f (patch)
tree5016bc1ed41bb40e17cd13cb33fa7d99271a230c /vespaclient-java
parentc1f6b93a94d8bb75707cb2643abf026eca45be7d (diff)
Don't use legacy file existence checking API
Diffstat (limited to 'vespaclient-java')
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java2
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespa/security/tool/CryptoToolsTest.java12
2 files changed, 7 insertions, 7 deletions
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java b/vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java
index df199c00eda..4eec1489360 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java
@@ -27,7 +27,7 @@ public class CliUtils {
return stdIn;
} else {
var inputPath = Paths.get(pathOrDash);
- if (!inputPath.toFile().exists()) {
+ if (!Files.exists(inputPath)) {
throw new IllegalArgumentException("Input file '%s' does not exist".formatted(inputPath.toString()));
}
return Files.newInputStream(inputPath);
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespa/security/tool/CryptoToolsTest.java b/vespaclient-java/src/test/java/com/yahoo/vespa/security/tool/CryptoToolsTest.java
index 91ca30fd564..55d0a10e660 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespa/security/tool/CryptoToolsTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespa/security/tool/CryptoToolsTest.java
@@ -230,8 +230,8 @@ public class CryptoToolsTest {
assertEquals("", procOut.stdOut());
assertEquals("", procOut.stdErr());
- assertTrue(privPath.toFile().exists());
- assertTrue(pubPath.toFile().exists());
+ assertTrue(Files.exists(privPath));
+ assertTrue(Files.exists(pubPath));
var encryptedPath = pathInTemp("encrypted.bin");
// TODO support (and test) public key via file
@@ -247,7 +247,7 @@ public class CryptoToolsTest {
var token = procOut.stdOut();
assertFalse(token.isBlank());
- assertTrue(encryptedPath.toFile().exists());
+ assertTrue(Files.exists(encryptedPath));
var decryptedPath = pathInTemp("decrypted.txt");
procOut = runMain(List.of(
@@ -279,8 +279,8 @@ public class CryptoToolsTest {
assertEquals("", procOut.stdOut());
assertEquals("", procOut.stdErr());
- assertTrue(privPath.toFile().exists());
- assertTrue(pubPath.toFile().exists());
+ assertTrue(Files.exists(privPath));
+ assertTrue(Files.exists(pubPath));
var encryptedPath = pathInTemp("encrypted.bin");
// Encryption emits token on stdout, so can't support ciphertext output via that channel.
@@ -297,7 +297,7 @@ public class CryptoToolsTest {
var token = procOut.stdOut();
assertFalse(token.isBlank());
- assertTrue(encryptedPath.toFile().exists());
+ assertTrue(Files.exists(encryptedPath));
procOut = runMain(List.of(
"decrypt",