HHH-12233 : Fix NPE in CacheImpl.

HHH-12233 : Combine the 2 if statements.
This commit is contained in:
Frank Langelage 2018-01-21 13:52:07 +01:00 committed by Gail Badner
parent f7fa11a3f4
commit 25cde9d1c5
1 changed files with 10 additions and 11 deletions

View File

@ -402,10 +402,8 @@ public class CacheImpl implements CacheImplementor {
// which Map contents are added to getAllSecondLevelCacheRegions. // which Map contents are added to getAllSecondLevelCacheRegions.
// In addition, if there is a CollectionRegion and an EntityRegion with the same name, then we // In addition, if there is a CollectionRegion and an EntityRegion with the same name, then we
// want the EntityRegion to be in the Map that gets returned. // want the EntityRegion to be in the Map that gets returned.
final Map<String, Region> allCacheRegions = new HashMap<String, Region>( final Map<String, Region> allCacheRegions = new HashMap<String, Region>();
2 + queryCaches.size() + otherRegionMap.size() + naturalIdRegionMap.size() if ( settings.isQueryCacheEnabled() ) {
+ collectionRegionMap.size() + entityRegionMap.size()
);
allCacheRegions.put( updateTimestampsCache.getRegion().getName(), updateTimestampsCache.getRegion() ); allCacheRegions.put( updateTimestampsCache.getRegion().getName(), updateTimestampsCache.getRegion() );
allCacheRegions.put( queryCache.getRegion().getName(), queryCache.getRegion() ); allCacheRegions.put( queryCache.getRegion().getName(), queryCache.getRegion() );
// keys in queryCaches may not be equal to the Region names // keys in queryCaches may not be equal to the Region names
@ -414,6 +412,7 @@ public class CacheImpl implements CacheImplementor {
for ( QueryCache queryCacheValue : queryCaches.values() ) { for ( QueryCache queryCacheValue : queryCaches.values() ) {
allCacheRegions.put( queryCacheValue.getRegion().getName(), queryCacheValue.getRegion() ); allCacheRegions.put( queryCacheValue.getRegion().getName(), queryCacheValue.getRegion() );
} }
}
allCacheRegions.putAll( otherRegionMap ); allCacheRegions.putAll( otherRegionMap );
allCacheRegions.putAll( naturalIdRegionMap ); allCacheRegions.putAll( naturalIdRegionMap );
allCacheRegions.putAll( collectionRegionMap ); allCacheRegions.putAll( collectionRegionMap );