File tree Expand file tree Collapse file tree
google-cloud-core/src/main/java/com/google/cloud
google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919import static com .google .common .base .MoreObjects .firstNonNull ;
2020import static com .google .common .base .Preconditions .checkArgument ;
2121import static com .google .common .base .Preconditions .checkNotNull ;
22+ import static java .nio .charset .StandardCharsets .UTF_8 ;
2223
2324import com .google .api .core .ApiClock ;
2425import com .google .api .core .CurrentMillisClock ;
3637import java .io .FileReader ;
3738import java .io .IOException ;
3839import java .io .InputStream ;
40+ import java .io .InputStreamReader ;
3941import java .io .ObjectInputStream ;
4042import java .io .Serializable ;
4143import java .lang .reflect .Method ;
44+ import java .net .HttpURLConnection ;
45+ import java .net .URL ;
4246import java .nio .charset .Charset ;
4347import java .util .Locale ;
4448import java .util .Objects ;
@@ -457,17 +461,6 @@ public Credentials getCredentials() {
457461 return credentials ;
458462 }
459463
460- /**
461- * Returns whether the credential is {@code NoCredentials} instance
462- * @return true if credential is a {@code NoCredentials} instance, false if not
463- */
464- public boolean credentialIsNoCredentialInstance () {
465- if (credentials != null ) {
466- return credentials .equals (NoCredentials .getInstance ());
467- }
468- return false ;
469- }
470-
471464 /**
472465 * Returns the authentication credentials. If required, credentials are scoped.
473466 */
Original file line number Diff line number Diff line change 2828import com .google .api .gax .grpc .UnaryCallSettings ;
2929import com .google .cloud .GrpcTransportOptions ;
3030import com .google .cloud .GrpcTransportOptions .ExecutorFactory ;
31+ import com .google .cloud .NoCredentials ;
3132import com .google .cloud .logging .LoggingException ;
3233import com .google .cloud .logging .LoggingOptions ;
3334import com .google .logging .v2 .CreateLogMetricRequest ;
@@ -81,11 +82,12 @@ public GrpcLoggingRpc(LoggingOptions options) throws IOException {
8182 ChannelProvider channelProvider ;
8283 // todo(mziccard): ChannelProvider should support null/absent credentials for testing
8384 if (options .getHost ().contains ("localhost" )
84- || options .credentialIsNoCredentialInstance ()) {
85- ManagedChannel managedChannel = ManagedChannelBuilder .forTarget (options .getHost ())
86- .usePlaintext (true )
87- .executor (executor )
88- .build ();
85+ || NoCredentials .getInstance ().equals (options .getCredentials ())) {
86+ ManagedChannel managedChannel =
87+ ManagedChannelBuilder .forTarget (options .getHost ())
88+ .usePlaintext (true )
89+ .executor (executor )
90+ .build ();
8991 channelProvider = FixedChannelProvider .create (managedChannel );
9092 } else {
9193 channelProvider = GrpcTransportOptions .setUpChannelProvider (
You can’t perform that action at this time.
0 commit comments