diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java index 4f4ca33530..2df5a604bd 100644 --- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java +++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java @@ -502,7 +502,7 @@ ChannelCredentials createS2ASecuredChannelCredentials() { // Try to load MTLS-MDS creds. File rootFile = new File(MTLS_MDS_ROOT); File certKeyFile = new File(MTLS_MDS_CERT_CHAIN_AND_KEY); - if (!rootFile.isFile() || !certKeyFile.isFile()) { + if (rootFile.isFile() && certKeyFile.isFile()) { // Try to connect to S2A using mTLS. ChannelCredentials mtlsToS2AChannelCredentials = null; try {