Skip to content

Commit 2407bb6

Browse files
committed
Check if file exists.
1 parent 0013ac5 commit 2407bb6

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

s2a/src/main/java/io/grpc/s2a/S2AChannelCredentials.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,17 @@ public ChannelCredentials build() throws IOException {
151151
checkState(!isNullOrEmpty(trustBundlePath), "trustBundlePath must not be null or empty.");
152152

153153
File privateKeyFile = new File(privateKeyPath);
154+
if (!privateKeyFile.exists()) {
155+
throw new IOException(privateKeyPath + " does not exist");
156+
}
154157
File certChainFile = new File(certChainPath);
158+
if (!certChainFile.exists()) {
159+
throw new IOException(certChainPath + " does not exist");
160+
}
155161
File trustBundleFile = new File(trustBundlePath);
162+
if (!trustBundleFile.exists()) {
163+
throw new IOException(trustBundlePath + " does not exist");
164+
}
156165

157166
s2aChannelCredentials =
158167
TlsChannelCredentials.newBuilder()

0 commit comments

Comments
 (0)