Skip to content

Commit 0f5e5af

Browse files
committed
Working fix suggestion for #827
1 parent 605e8a2 commit 0f5e5af

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Parse/src/main/java/com/parse/ParseObject.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,10 +1448,14 @@ public Task<Void> then(Task<Void> task) throws Exception {
14481448
ParseOperationSet nextOperation = opIterator.next();
14491449
nextOperation.mergeFrom(operationsBeforeSave);
14501450
if (store != null) {
1451-
task = task.onSuccessTask(new Continuation<Void, Task<Void>>() {
1451+
task = task.continueWithTask(new Continuation<Void, Task<Void>>() {
14521452
@Override
14531453
public Task<Void> then(Task<Void> task) throws Exception {
1454-
return store.updateDataForObjectAsync(ParseObject.this);
1454+
if (task.isFaulted()) {
1455+
return Task.forResult(null);
1456+
} else {
1457+
return store.updateDataForObjectAsync(ParseObject.this);
1458+
}
14551459
}
14561460
});
14571461
}

Parse/src/test/java/com/parse/ParseInstallationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public void testMissingRequiredFieldWhenSaveAsync() throws Exception {
146146
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
147147
assertNotNull(installation);
148148
installation.put("key", "value");
149-
installation.saveAsync(sessionToken, toAwait);
149+
ParseTaskUtils.wait(installation.saveAsync(sessionToken, toAwait));
150150
verify(controller).getAsync();
151151
verify(objController, times(2)).saveAsync(
152152
any(ParseObject.State.class),
@@ -187,7 +187,7 @@ public void testObjectNotFoundWhenSaveAsync() throws Exception {
187187
assertNotNull(installation);
188188
installation.setState(state);
189189
installation.put("key", "value");
190-
installation.saveAsync(sessionToken, toAwait);
190+
ParseTaskUtils.wait(installation.saveAsync(sessionToken, toAwait));
191191

192192
verify(controller).getAsync();
193193
verify(objController, times(2)).saveAsync(

0 commit comments

Comments
 (0)