Skip to content

Commit

Permalink
check Strings null or empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta19 committed Nov 6, 2024
1 parent 30a37c2 commit c3b93a0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.google.auth.oauth2.S2A;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.Files;
Expand Down Expand Up @@ -448,7 +449,7 @@ ChannelCredentials createMtlsToS2AChannelCredentials(
}

ChannelCredentials createPlaintextToS2AChannelCredentials(String plaintextAddress) {
if (plaintextAddress.isEmpty()) {
if (Strings.isNullOrEmpty(plaintextAddress)) {
return null;
}
return S2AChannelCredentials.newBuilder(plaintextAddress, InsecureChannelCredentials.create())
Expand All @@ -459,7 +460,7 @@ ChannelCredentials createS2ASecuredChannelCredentials() {
S2A s2aUtils = S2A.newBuilder().build();
String plaintextAddress = s2aUtils.getPlaintextS2AAddress();
String mtlsAddress = s2aUtils.getMtlsS2AAddress();
if (mtlsAddress.isEmpty()) {
if (Strings.isNullOrEmpty(mtlsAddress)) {
// Fallback to plaintext connection to S2A.
return createPlaintextToS2AChannelCredentials(plaintextAddress);
}
Expand Down

0 comments on commit c3b93a0

Please sign in to comment.