Skip to content

Commit b0ef57b

Browse files
committed
remove redundant type casts
1 parent 8e23fe6 commit b0ef57b

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import java.net.URI;
5353
import java.net.URISyntaxException;
5454
import java.net.URL;
55+
import java.nio.charset.StandardCharsets;
5556
import java.nio.file.Files;
5657
import java.nio.file.Paths;
5758
import java.security.GeneralSecurityException;
@@ -467,9 +468,7 @@ static UserCredentials getCredentialsFromCode(
467468
LOG.finer("++enter++\t" + callerClassName);
468469
UserCredentials credentials = userAuthorizer.getCredentialsFromCode(code, URI.create(""));
469470
if (httpTransportFactory != null) {
470-
credentials =
471-
(UserCredentials)
472-
credentials.toBuilder().setHttpTransportFactory(httpTransportFactory).build();
471+
credentials = credentials.toBuilder().setHttpTransportFactory(httpTransportFactory).build();
473472
}
474473
return credentials;
475474
}
@@ -665,16 +664,13 @@ private static GoogleCredentials getExternalAccountAuthCredentials(
665664
ExternalAccountCredentials credentials;
666665
if (credentialsPath != null) {
667666
try (InputStream stream = Files.newInputStream(Paths.get(credentialsPath))) {
668-
credentials =
669-
(ExternalAccountCredentials)
670-
ExternalAccountCredentials.fromStream(stream, httpTransportFactory);
667+
credentials = ExternalAccountCredentials.fromStream(stream, httpTransportFactory);
671668
}
672669
} else if (jsonObject != null) {
673670
credentials =
674-
(ExternalAccountCredentials)
675-
ExternalAccountCredentials.fromStream(
676-
new ByteArrayInputStream(jsonObject.toString().getBytes()),
677-
httpTransportFactory);
671+
ExternalAccountCredentials.fromStream(
672+
new ByteArrayInputStream(jsonObject.toString().getBytes(StandardCharsets.UTF_8)),
673+
httpTransportFactory);
678674
} else {
679675
IllegalArgumentException ex =
680676
new IllegalArgumentException("Insufficient info provided for external authentication");

0 commit comments

Comments
 (0)