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/2d2435fd Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/2d2435fd Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/2d2435fd Branch: refs/heads/release-2.1.1 Commit: 2d2435fde5c8e9d4819b64af923f1d6ba96f4c61 Parents: 666c49e Author: Dave Johnson <snoopd...@apache.org> Authored: Wed Apr 20 11:02:14 2016 -0400 Committer: Dave Johnson <snoopd...@apache.org> Committed: Wed Apr 20 11:02:14 2016 -0400 ---------------------------------------------------------------------- .../usergrid/corepersistence/ApplicationIdCacheImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/2d2435fd/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; } }); }