Skip to content

Commit 4c539c2

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 2765 b: refs/heads/update-datastore c: d27d567 h: refs/heads/master i: 2763: 0b7d9d7
1 parent 12cc979 commit 4c539c2

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
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: fbe5a1dc9d2a06551768df2a5e0a39038f22aa8b
8+
refs/heads/update-datastore: d27d567606f198822c5ec2b4a5e8c592e263abec
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/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/update-datastore/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/update-datastore/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/update-datastore/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/update-datastore/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/update-datastore/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)