Skip to content

Commit ec93f68

Browse files
committed
address pr review
1 parent ccdec62 commit ec93f68

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOAuthUtility.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,13 +684,18 @@ private static GoogleCredentials getExternalAccountAuthCredentials(
684684
ExternalAccountCredentials credentials;
685685
if (credentialsPath != null) {
686686
try (InputStream stream = Files.newInputStream(Paths.get(credentialsPath))) {
687-
credentials = ExternalAccountCredentials.fromStream(stream, httpTransportFactory);
687+
credentials =
688+
httpTransportFactory != null
689+
? ExternalAccountCredentials.fromStream(stream, httpTransportFactory)
690+
: ExternalAccountCredentials.fromStream(stream);
688691
}
689692
} else if (jsonObject != null) {
693+
InputStream stream =
694+
new ByteArrayInputStream(jsonObject.toString().getBytes(StandardCharsets.UTF_8));
690695
credentials =
691-
ExternalAccountCredentials.fromStream(
692-
new ByteArrayInputStream(jsonObject.toString().getBytes(StandardCharsets.UTF_8)),
693-
httpTransportFactory);
696+
httpTransportFactory != null
697+
? ExternalAccountCredentials.fromStream(stream, httpTransportFactory)
698+
: ExternalAccountCredentials.fromStream(stream);
694699
} else {
695700
IllegalArgumentException ex =
696701
new IllegalArgumentException("Insufficient info provided for external authentication");

0 commit comments

Comments
 (0)