File tree Expand file tree Collapse file tree
java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc Expand file tree Collapse file tree Original file line number Diff line number Diff 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" );
You can’t perform that action at this time.
0 commit comments