usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [09/12] incubator-usergrid git commit: Updates observable short circuit and fixes NPE on empty results
Date Mon, 04 May 2015 17:32:59 GMT
Updates observable short circuit and fixes NPE on empty results


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5bb77985
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5bb77985
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5bb77985

Branch: refs/heads/USERGRID-609
Commit: 5bb77985ba386b72d66a5584057a5d98b3f3e111
Parents: a673c81
Author: Todd Nine <tnine@apigee.com>
Authored: Mon May 4 11:27:25 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Mon May 4 11:27:25 2015 -0600

----------------------------------------------------------------------
 .../elasticsearch/AbstractElasticSearchFilter.java  | 16 ++++++++--------
 .../org/apache/usergrid/persistence/Results.java    |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5bb77985/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/elasticsearch/AbstractElasticSearchFilter.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/elasticsearch/AbstractElasticSearchFilter.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/elasticsearch/AbstractElasticSearchFilter.java
index 004a696..f403e21 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/elasticsearch/AbstractElasticSearchFilter.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/elasticsearch/AbstractElasticSearchFilter.java
@@ -108,20 +108,13 @@ public abstract class AbstractElasticSearchFilter extends AbstractPathFilter<Id,
                         final CandidateResults candidateResults =
                             applicationEntityIndex.search( searchEdge, searchTypes, query,
limit, currentOffSet );
 
-                        /**
-                         * No candidates, we're done
-                         */
-                        if ( candidateResults.size() == 0 ) {
-                            subscriber.onCompleted();
-                            return;
-                        }
 
 
                         for( CandidateResult candidateResult: candidateResults){
 
                             //our subscriber unsubscribed, break out
                             if(subscriber.isUnsubscribed()){
-                              return;
+                                return;
                             }
 
                             final Candidate candidate = new Candidate( candidateResult, searchEdge
);
@@ -134,6 +127,13 @@ public abstract class AbstractElasticSearchFilter extends AbstractPathFilter<Id,
                             currentOffSet++;
                         }
 
+                        /**
+                         * No candidates, we're done
+                         */
+                        if (candidateResults.size() < limit) {
+                            subscriber.onCompleted();
+                            return;
+                        }
 
                     }
                     catch ( Throwable t ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5bb77985/stack/core/src/main/java/org/apache/usergrid/persistence/Results.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/Results.java b/stack/core/src/main/java/org/apache/usergrid/persistence/Results.java
index e572070..fa221f5 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/Results.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/Results.java
@@ -1293,7 +1293,7 @@ public class Results implements Iterable<Entity> {
     /** uses cursor to get next batch of Results (returns null if no cursor) */
     public Results getNextPageResults() throws Exception {
         if ( queryExecutor == null || !queryExecutor.hasNext() ) {
-            return null;
+            return new Results();
         }
 
 


Mime
View raw message