Skip to content

Commit

Permalink
Check if file exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta19 committed Sep 26, 2024
1 parent 0013ac5 commit 2407bb6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions s2a/src/main/java/io/grpc/s2a/S2AChannelCredentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,17 @@ public ChannelCredentials build() throws IOException {
checkState(!isNullOrEmpty(trustBundlePath), "trustBundlePath must not be null or empty.");

File privateKeyFile = new File(privateKeyPath);
if (!privateKeyFile.exists()) {
throw new IOException(privateKeyPath + " does not exist");
}
File certChainFile = new File(certChainPath);
if (!certChainFile.exists()) {
throw new IOException(certChainPath + " does not exist");
}
File trustBundleFile = new File(trustBundlePath);
if (!trustBundleFile.exists()) {
throw new IOException(trustBundlePath + " does not exist");
}

s2aChannelCredentials =
TlsChannelCredentials.newBuilder()
Expand Down

0 comments on commit 2407bb6

Please sign in to comment.