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/02/17 00:16:26 UTC

incubator-usergrid git commit: Fixes emitting null, which should not happen in observable.

Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-273 3c83bcb3f -> bc3141596


Fixes emitting null, which should not happen in observable.


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

Branch: refs/heads/USERGRID-273
Commit: bc314159610a3e52093dfae516591309a4205f46
Parents: 3c83bcb
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Feb 16 15:16:25 2015 -0800
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Feb 16 15:16:25 2015 -0800

----------------------------------------------------------------------
 .../collection/impl/EntityCollectionManagerImpl.java      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc314159/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
index 8c754c1..4f04846 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
@@ -230,16 +230,16 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
         Preconditions.checkNotNull( entityId.getUuid(), "Entity id uuid required in load stage" );
         Preconditions.checkNotNull( entityId.getType(), "Entity id type required in load stage" );
 
-        return load( Collections.singleton( entityId ) ).map( new Func1<EntitySet, Entity>() {
+        return load( Collections.singleton( entityId ) ).flatMap( new Func1<EntitySet, Observable<Entity>>() {
             @Override
-            public Entity call( final EntitySet entitySet ) {
+            public Observable<Entity> call( final EntitySet entitySet ) {
                 final MvccEntity entity = entitySet.getEntity( entityId );
 
-                if ( entity == null ) {
-                    return null;
+                if ( entity == null || !entity.getEntity().isPresent()) {
+                    return Observable.empty();
                 }
 
-                return entity.getEntity().orNull();
+                return Observable.just( entity.getEntity().get() );
             }
         } );
     }