Skip to content

Commit 934293b

Browse files
cmaanneozwu
authored andcommitted
---
yaml --- r: 8319 b: refs/heads/snehashah-snippets c: c25af8d h: refs/heads/master i: 8317: 8a2d4e7 8315: 117a655 8311: 48d5d23 8303: a63f59a 8287: 6549fc7 8255: 54e215d 8191: 8fe6b6e
1 parent 83c4270 commit 934293b

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
@@ -56,7 +56,7 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5656
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5757
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5858
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
59-
refs/heads/snehashah-snippets: 242e30c43e754ba4e0595110362bedb474672433
59+
refs/heads/snehashah-snippets: c25af8d1d0c01351e4e57cdb91d786834486319f
6060
refs/tags/v0.20.2: 5a53aa06f268b74dc192204f4f83e1a04d40f65d
6161
refs/tags/v0.20.3: 269025fdc14af0b68df214a4518be5379b2fe569
6262
refs/tags/v0.21.0: f88b200e00e41ba6262ee88a92abba38b1e2417e

branches/snehashah-snippets/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
}

branches/snehashah-snippets/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)