Skip to content

Commit 7cd3529

Browse files
committed
Refactor: Enhance error handling and readability per review comments
1 parent b7e8ec6 commit 7cd3529

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

oauth2_http/java/com/google/auth/mtls/X509Provider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public String getCertificatePath() throws IOException {
9898
String certPath = loadedConfig.getCertPath();
9999
if (Strings.isNullOrEmpty(certPath)) {
100100
// Ensure the loaded configuration actually contains the required path.
101-
throw new IOException(
101+
throw new CertificateSourceUnavailableException(
102102
"Certificate configuration loaded successfully, but does not contain a 'certificate_file' path.");
103103
}
104104
return certPath;

oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public static class CertificateConfig implements java.io.Serializable {
172172
certificateConfigLocation != null && !certificateConfigLocation.isEmpty();
173173

174174
checkArgument(
175-
!(!useDefault && !locationIsPresent),
175+
(useDefault || locationIsPresent),
176176
"credentials: \"certificate\" object must either specify a certificate_config_location or use_default_certificate_config should be true");
177177

178178
checkArgument(

0 commit comments

Comments
 (0)