HHH-13505 : NullPointerException thrown by StatisticsImpl#getCacheRegionStatistics

This commit is contained in:
Scott Marlow 2019-07-19 12:15:14 -04:00 committed by gbadner
parent f7498b2340
commit 330b5da305
1 changed files with 5 additions and 0 deletions

View File

@ -628,6 +628,11 @@ public class StatisticsImpl implements StatisticsImplementor, Service {
Region region = sessionFactory.getCache().getRegion( regionName ); Region region = sessionFactory.getCache().getRegion( regionName );
if ( region == null ) { if ( region == null ) {
if ( ! sessionFactory.getSessionFactoryOptions().isQueryCacheEnabled() ) {
return null;
}
// this is the pre-5.3 behavior. and since this is a pre-5.3 method it should behave consistently // this is the pre-5.3 behavior. and since this is a pre-5.3 method it should behave consistently
// NOTE that this method is deprecated // NOTE that this method is deprecated
region = sessionFactory.getCache().getQueryResultsCache( regionName ).getRegion(); region = sessionFactory.getCache().getQueryResultsCache( regionName ).getRegion();