Ensure that applicationId cache does not cache nulls.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/220b672a Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/220b672a Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/220b672a Branch: refs/heads/9f45130_app_cache_fix Commit: 220b672a75aa0490cb2e01b879df6a771f5a5f1c Parents: 7fbe8c8 Author: Dave Johnson <snoopd...@apache.org> Authored: Wed Apr 20 11:02:14 2016 -0400 Committer: Mike Dunker <mdun...@apigee.com> Committed: Wed Apr 20 08:55:04 2016 -0700 ---------------------------------------------------------------------- .../usergrid/corepersistence/ApplicationIdCacheImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/220b672a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java index 7745359..7403c81 100644 --- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java +++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java @@ -27,6 +27,7 @@ import org.apache.usergrid.persistence.EntityManager; import org.apache.usergrid.persistence.Schema; import org.apache.usergrid.persistence.collection.EntityCollectionManager; import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl; +import org.apache.usergrid.persistence.exceptions.PersistenceException; import org.apache.usergrid.persistence.model.entity.Id; import org.apache.usergrid.persistence.model.entity.SimpleId; import org.apache.usergrid.persistence.model.field.StringField; @@ -65,7 +66,11 @@ public class ApplicationIdCacheImpl implements ApplicationIdCache { .build(new CacheLoader<String, UUID>() { @Override public UUID load(final String key) throws Exception { - return fetchApplicationId(key); + UUID appId = fetchApplicationId(key); + if ( appId == null ) { + throw new PersistenceException("Error getting applicationId"); + } + return appId; } }); }