You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/04/24 17:35:43 UTC

incubator-usergrid git commit: Fixes empty results bug

Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-593 6098d9b60 -> 6904c9dbd


Fixes empty results bug


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

Branch: refs/heads/USERGRID-593
Commit: 6904c9dbdf80e4dee303ad020d4d8c99a9f3946c
Parents: 6098d9b
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Apr 24 09:35:40 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Apr 24 09:35:40 2015 -0600

----------------------------------------------------------------------
 .../corepersistence/results/AbstractGraphQueryExecutor.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6904c9db/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/AbstractGraphQueryExecutor.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/AbstractGraphQueryExecutor.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/AbstractGraphQueryExecutor.java
index 0bea013..cf0764e 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/AbstractGraphQueryExecutor.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/AbstractGraphQueryExecutor.java
@@ -20,6 +20,7 @@
 package org.apache.usergrid.corepersistence.results;
 
 
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
@@ -78,7 +79,7 @@ public abstract class AbstractGraphQueryExecutor implements QueryExecutor {
 
         //hasn't been set up yet, run through our first setup
         if ( observableIterator == null ) {
-            //assign them to an interator.  this now uses an internal buffer with backpressure, so we won't load all
+            //assign them to an iterator.  this now uses an internal buffer with backpressure, so we won't load all
             // results
             //set up our command builder
             final CommandBuilder commandBuilder = new CommandBuilder( applicationScope, sourceId, requestCursor, limit );
@@ -91,6 +92,11 @@ public abstract class AbstractGraphQueryExecutor implements QueryExecutor {
                 commandBuilder.build( new EntityLoadCommand( entityCollectionManagerFactory, applicationScope ) );
 
             this.observableIterator = resultsObservable.toBlocking().getIterator();
+
+            if(!observableIterator.hasNext()){
+                //no results, generate an empty one
+                this.observableIterator = Collections.singleton(new Results()).iterator();
+            }
         }