Skip to content

Commit 345c8d3

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 4733 b: refs/heads/logging-alpha c: d27d567 h: refs/heads/master i: 4731: c4ac8b3
1 parent 3446206 commit 345c8d3

7 files changed

Lines changed: 17 additions & 20 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ refs/heads/compute-alpha: 969cba2627f1d53d352cc4a5ffe0879dacf65e6c
1212
refs/heads/dns-alpha: 2f90e7e338349287ace33375896907af0f032ca1
1313
refs/heads/dns-alpha-batch: 17442b07867021b85d0452f5f3eda29a3413288f
1414
refs/heads/gcs-nio: 283aeaf15efdcf3621eb6859f05e55ad7764375d
15-
refs/heads/logging-alpha: fbe5a1dc9d2a06551768df2a5e0a39038f22aa8b
15+
refs/heads/logging-alpha: d27d567606f198822c5ec2b4a5e8c592e263abec
1616
refs/tags/v0.1.0: a615317f7424ed58621b1f65d5c4d8cbbe8a6ed8
1717
refs/tags/v0.1.1: 7a7f6985fe465e9dd6a075af55493f42b4933be0
1818
refs/tags/v0.1.2: 3eb3fe866ba22487686048f45d927b8c8638ea3f

branches/logging-alpha/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static com.google.common.base.MoreObjects.firstNonNull;
2020
import static com.google.common.base.Preconditions.checkArgument;
21-
import static com.google.common.base.Preconditions.checkNotNull;
2221
import static java.nio.charset.StandardCharsets.UTF_8;
2322

2423
import com.google.api.client.extensions.appengine.http.UrlFetchTransport;
@@ -229,8 +228,7 @@ public B clock(Clock clock) {
229228
* @return the builder
230229
*/
231230
public B projectId(String projectId) {
232-
this.projectId =
233-
checkNotNull(projectId, "Project ID cannot be set to null. Leave unset for default.");
231+
this.projectId = projectId;
234232
return self();
235233
}
236234

branches/logging-alpha/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreException.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ public class DatastoreException extends BaseServiceException {
3434

3535
// see https://cloud.google.com/datastore/docs/concepts/errors#Error_Codes"
3636
private static final Set<Error> RETRYABLE_ERRORS = ImmutableSet.of(
37-
new Error(409, "ABORTED"),
38-
new Error(403, "DEADLINE_EXCEEDED"),
39-
new Error(503, "UNAVAILABLE"));
37+
new Error(10, "ABORTED"), new Error(4, "DEADLINE_EXCEEDED"), new Error(14, "UNAVAILABLE"));
4038
private static final long serialVersionUID = 2663750991205874435L;
4139

4240
public DatastoreException(int code, String message, String reason, Throwable cause) {

branches/logging-alpha/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DateTime.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ Object fromPb(byte[] bytesPb) throws InvalidProtocolBufferException {
106106
com.google.protobuf.Timestamp.parseFrom(bytesPb)));
107107
}
108108

109-
protected static long timestampPbToMicroseconds(com.google.protobuf.Timestamp timestampPb) {
109+
static long timestampPbToMicroseconds(com.google.protobuf.Timestamp timestampPb) {
110110
return timestampPb.getSeconds() * 1000000 + timestampPb.getNanos() / 1000;
111111
}
112112

113-
protected static com.google.protobuf.Timestamp microsecondsToTimestampPb(long microseconds) {
113+
static com.google.protobuf.Timestamp microsecondsToTimestampPb(long microseconds) {
114114
long seconds = microseconds / 1000000;
115115
int nanos = (int) (microseconds % 1000000) * 1000;
116116
return com.google.protobuf.Timestamp.newBuilder().setSeconds(seconds).setNanos(nanos).build();

branches/logging-alpha/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResultsImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ protected T computeNext() {
9393
sendRequest();
9494
}
9595
if (!entityResultPbIter.hasNext()) {
96+
cursor = runQueryResponsePb.getBatch().getEndCursor();
9697
return endOfData();
9798
}
9899
com.google.datastore.v1beta3.EntityResult entityResultPb = entityResultPbIter.next();

branches/logging-alpha/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreExceptionTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,29 @@ public class DatastoreExceptionTest {
3838

3939
@Test
4040
public void testDatastoreException() throws Exception {
41-
DatastoreException exception = new DatastoreException(409, "message", "ABORTED");
42-
assertEquals(409, exception.code());
41+
DatastoreException exception = new DatastoreException(10, "message", "ABORTED");
42+
assertEquals(10, exception.code());
4343
assertEquals("ABORTED", exception.reason());
4444
assertEquals("message", exception.getMessage());
4545
assertTrue(exception.retryable());
4646
assertTrue(exception.idempotent());
4747

48-
exception = new DatastoreException(403, "message", "DEADLINE_EXCEEDED");
49-
assertEquals(403, exception.code());
48+
exception = new DatastoreException(4, "message", "DEADLINE_EXCEEDED");
49+
assertEquals(4, exception.code());
5050
assertEquals("DEADLINE_EXCEEDED", exception.reason());
5151
assertEquals("message", exception.getMessage());
5252
assertTrue(exception.retryable());
5353
assertTrue(exception.idempotent());
5454

55-
exception = new DatastoreException(503, "message", "UNAVAILABLE");
56-
assertEquals(503, exception.code());
55+
exception = new DatastoreException(14, "message", "UNAVAILABLE");
56+
assertEquals(14, exception.code());
5757
assertEquals("UNAVAILABLE", exception.reason());
5858
assertEquals("message", exception.getMessage());
5959
assertTrue(exception.retryable());
6060
assertTrue(exception.idempotent());
6161

62-
exception = new DatastoreException(500, "message", "INTERNAL");
63-
assertEquals(500, exception.code());
62+
exception = new DatastoreException(2, "message", "INTERNAL");
63+
assertEquals(2, exception.code());
6464
assertEquals("INTERNAL", exception.reason());
6565
assertEquals("message", exception.getMessage());
6666
assertFalse(exception.retryable());
@@ -77,14 +77,14 @@ public void testDatastoreException() throws Exception {
7777

7878
@Test
7979
public void testTranslateAndThrow() throws Exception {
80-
DatastoreException cause = new DatastoreException(503, "message", "UNAVAILABLE");
80+
DatastoreException cause = new DatastoreException(14, "message", "UNAVAILABLE");
8181
RetryHelper.RetryHelperException exceptionMock = createMock(RetryHelper.RetryHelperException.class);
8282
expect(exceptionMock.getCause()).andReturn(cause).times(2);
8383
replay(exceptionMock);
8484
try {
8585
DatastoreException.translateAndThrow(exceptionMock);
8686
} catch (BaseServiceException ex) {
87-
assertEquals(503, ex.code());
87+
assertEquals(14, ex.code());
8888
assertEquals("message", ex.getMessage());
8989
assertTrue(ex.retryable());
9090
assertTrue(ex.idempotent());

branches/logging-alpha/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ public void testRetryableException() throws Exception {
986986
EasyMock.expect(rpcFactoryMock.create(EasyMock.anyObject(DatastoreOptions.class)))
987987
.andReturn(rpcMock);
988988
EasyMock.expect(rpcMock.lookup(requestPb))
989-
.andThrow(new DatastoreException(503, "UNAVAILABLE", "UNAVAILABLE", null))
989+
.andThrow(new DatastoreException(14, "UNAVAILABLE", "UNAVAILABLE", null))
990990
.andReturn(responsePb);
991991
EasyMock.replay(rpcFactoryMock, rpcMock);
992992
DatastoreOptions options = this.options.toBuilder()

0 commit comments

Comments
 (0)