fix npe in CachingQueryRunner

This commit is contained in:
Xavier Léauté 2014-04-09 17:04:42 -07:00
parent c05f169171
commit 69a8723f18
1 changed files with 10 additions and 5 deletions

View File

@ -84,11 +84,16 @@ public class CachingQueryRunner<T> implements QueryRunner<T>
&& strategy != null
&& cacheConfig.isPopulateCache();
final Cache.NamedKey key = CacheUtil.computeSegmentCacheKey(
segmentIdentifier,
segmentDescriptor,
strategy.computeCacheKey(query)
);
final Cache.NamedKey key;
if(strategy != null && (useCache || populateCache)) {
key = CacheUtil.computeSegmentCacheKey(
segmentIdentifier,
segmentDescriptor,
strategy.computeCacheKey(query)
);
} else {
key = null;
}
if(useCache) {
final Function cacheFn = strategy.pullFromCache();