@@ -144,7 +144,8 @@ public static interface OnQueryLoadListener<T extends ParseObject> {
144144
145145 private List <T > objects = new ArrayList <>();
146146
147- private Set <ParseQuery > runningQueries = Collections .newSetFromMap (new ConcurrentHashMap <ParseQuery , Boolean >());
147+ private Set <ParseQuery > runningQueries =
148+ Collections .newSetFromMap (new ConcurrentHashMap <ParseQuery , Boolean >());
148149
149150
150151 // Used to keep track of the pages of objects when using CACHE_THEN_NETWORK. When using this,
@@ -375,7 +376,8 @@ private void loadObjects(final int page, final boolean shouldClear) {
375376 objectPages .add (page , new ArrayList <T >());
376377 }
377378
378- // In the case of CACHE_THEN_NETWORK, two callbacks will be called. Using this flag to keep track,
379+ // In the case of CACHE_THEN_NETWORK, two callbacks will be called. Using this flag to keep
380+ // track of the callbacks.
379381 final Capture <Boolean > firstCallBack = new Capture <>(true );
380382
381383 runningQueries .add (query );
@@ -390,18 +392,22 @@ public void done(List<T> foundObjects, ParseException e) {
390392 }
391393 // In the case of CACHE_THEN_NETWORK, two callbacks will be called. We can only remove the
392394 // query after the second callback.
393- if (query .getCachePolicy () != CachePolicy .CACHE_THEN_NETWORK ||
394- (query .getCachePolicy () == CachePolicy .CACHE_THEN_NETWORK && !firstCallBack .get ())) {
395+ if (Parse .isLocalDatastoreEnabled () ||
396+ (query .getCachePolicy () != CachePolicy .CACHE_THEN_NETWORK ) ||
397+ (query .getCachePolicy () == CachePolicy .CACHE_THEN_NETWORK && !firstCallBack .get ())) {
395398 runningQueries .remove (query );
396399 }
400+
397401 if ((!Parse .isLocalDatastoreEnabled () &&
398- query .getCachePolicy () == CachePolicy .CACHE_ONLY )
399- && (e != null ) && e .getCode () == ParseException .CACHE_MISS ) {
402+ query .getCachePolicy () == CachePolicy .CACHE_ONLY ) &&
403+ (e != null ) && e .getCode () == ParseException .CACHE_MISS ) {
400404 // no-op on cache miss
401405 return ;
402406 }
403407
404- if ((e != null ) && ((e .getCode () == ParseException .CONNECTION_FAILED ) || (e .getCode () != ParseException .CACHE_MISS ))) {
408+ if ((e != null ) &&
409+ ((e .getCode () == ParseException .CONNECTION_FAILED ) ||
410+ (e .getCode () != ParseException .CACHE_MISS ))) {
405411 hasNextPage = true ;
406412 } else if (foundObjects != null ) {
407413 if (shouldClear && firstCallBack .get ()) {
0 commit comments