Skip to content

Commit 6f56607

Browse files
cmaanneozwu
authored andcommitted
---
yaml --- r: 8219 b: refs/heads/master c: c25af8d h: refs/heads/master i: 8217: 9cfe931 8215: 1d7d978
1 parent 399aef3 commit 6f56607

3 files changed

Lines changed: 12 additions & 2 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: 242e30c43e754ba4e0595110362bedb474672433
2+
refs/heads/master: c25af8d1d0c01351e4e57cdb91d786834486319f
33
refs/heads/travis: 47e4fee4fd5af9b2a8ce46f23c72ec95f9b195b2
44
refs/heads/gh-pages: 0114589947fea527ea3831330789accedbecf45c
55
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

trunk/google-cloud-datastore/src/main/java/com/google/cloud/datastore/TransactionExceptionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class TransactionExceptionHandler {
3333
public RetryResult beforeEval(Exception exception) {
3434
if (exception instanceof DatastoreException) {
3535
DatastoreException e = getInnerException((DatastoreException) exception);
36-
if (e.getCode() == ABORTED_CODE || e.getReason().equals("ABORTED")) {
36+
if (e.getCode() == ABORTED_CODE || e.getReason()!=null && e.getReason().equals("ABORTED")) {
3737
return Interceptor.RetryResult.RETRY;
3838
}
3939
}

trunk/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TransactionExceptionHandlerTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,15 @@ public void testShouldTry() {
6060

6161
assertTrue(transactionHandler.shouldRetry(nestedDatastoreException, null));
6262
assertFalse(handler.shouldRetry(nestedDatastoreException, null));
63+
64+
DatastoreException nestedUserException =
65+
new DatastoreException(
66+
BaseServiceException.UNKNOWN_CODE,
67+
"",
68+
null,
69+
new RuntimeException(""));
70+
71+
assertFalse(transactionHandler.shouldRetry(nestedUserException, null));
72+
assertFalse(handler.shouldRetry(nestedDatastoreException, null));
6373
}
6474
}

0 commit comments

Comments
 (0)