File tree Expand file tree Collapse file tree
trunk/google-cloud-datastore/src
main/java/com/google/cloud/datastore
test/java/com/google/cloud/datastore Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
2- refs/heads/master: 242e30c43e754ba4e0595110362bedb474672433
2+ refs/heads/master: c25af8d1d0c01351e4e57cdb91d786834486319f
33refs/heads/travis: 47e4fee4fd5af9b2a8ce46f23c72ec95f9b195b2
44refs/heads/gh-pages: 0114589947fea527ea3831330789accedbecf45c
55refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments