Skip to content

Commit 2036897

Browse files
authored
---
yaml --- r: 5613 b: refs/heads/master c: ae3c787 h: refs/heads/master i: 5611: cc6368e
1 parent 3a8f5f4 commit 2036897

5 files changed

Lines changed: 14 additions & 7 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3beba47d7ef17bdac91d286ac84f4285dc3ad2a2
2+
refs/heads/master: ae3c7877c6e3eda7012bd83dbd3f1966913bc906
33
refs/heads/travis: dae77e558b884bc1b165155482d76c8e40b0fca4
44
refs/heads/gh-pages: 049a9668af6afce3b5840dee8be005b0e6b43506
55
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

trunk/google-cloud-core/src/main/java/com/google/cloud/NoCredentials.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.google.cloud;
1818

1919
import com.google.auth.oauth2.OAuth2Credentials;
20-
2120
import java.io.ObjectStreamException;
2221

2322
/**
@@ -38,4 +37,12 @@ private Object readResolve() throws ObjectStreamException {
3837
public static NoCredentials getInstance() {
3938
return INSTANCE;
4039
}
40+
41+
@Override
42+
public boolean equals(Object obj) {
43+
if (!(obj instanceof NoCredentials)) {
44+
return false;
45+
}
46+
return this == obj;
47+
}
4148
}

trunk/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static com.google.common.base.MoreObjects.firstNonNull;
2020
import static com.google.common.base.Preconditions.checkArgument;
2121
import static com.google.common.base.Preconditions.checkNotNull;
22-
import static java.nio.charset.StandardCharsets.UTF_8;
2322

2423
import com.google.api.core.ApiClock;
2524
import com.google.api.core.CurrentMillisClock;
@@ -38,12 +37,9 @@
3837
import java.io.FileReader;
3938
import java.io.IOException;
4039
import java.io.InputStream;
41-
import java.io.InputStreamReader;
4240
import java.io.ObjectInputStream;
4341
import java.io.Serializable;
4442
import java.lang.reflect.Method;
45-
import java.net.HttpURLConnection;
46-
import java.net.URL;
4743
import java.nio.charset.Charset;
4844
import java.util.Locale;
4945
import java.util.Objects;

trunk/google-cloud-core/src/test/java/com/google/cloud/ServiceOptionsTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud;
1818

19+
import static junit.framework.TestCase.assertFalse;
1920
import static org.junit.Assert.assertEquals;
2021
import static org.junit.Assert.assertNotEquals;
2122
import static org.junit.Assert.assertSame;
@@ -231,6 +232,9 @@ public void testBuilder() {
231232
@Test
232233
public void testBuilderNoCredentials() {
233234
assertEquals(NoCredentials.getInstance(), OPTIONS_NO_CREDENTIALS.getCredentials());
235+
assertTrue(NoCredentials.getInstance().equals(OPTIONS_NO_CREDENTIALS.getCredentials()));
236+
assertFalse(NoCredentials.getInstance().equals(OPTIONS.getCredentials()));
237+
assertFalse(NoCredentials.getInstance().equals(null));
234238
assertSame(TEST_CLOCK, OPTIONS_NO_CREDENTIALS.getClock());
235239
assertEquals("host", OPTIONS_NO_CREDENTIALS.getHost());
236240
assertEquals("project-id", OPTIONS_NO_CREDENTIALS.getProjectId());

trunk/google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/GrpcLoggingRpc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public GrpcLoggingRpc(LoggingOptions options) throws IOException {
8282
ChannelProvider channelProvider;
8383
// todo(mziccard): ChannelProvider should support null/absent credentials for testing
8484
if (options.getHost().contains("localhost")
85-
|| options.getCredentials().equals(NoCredentials.getInstance())) {
85+
|| NoCredentials.getInstance().equals(options.getCredentials())) {
8686
ManagedChannel managedChannel = ManagedChannelBuilder.forTarget(options.getHost())
8787
.usePlaintext(true)
8888
.executor(executor)

0 commit comments

Comments
 (0)