In general for 5.1, null is preferred over throwing an exception when a cache region cannot be resolved. Should the same be true for master? In master, org.hibernate.stat.Statistics#getSecondLevelCacheStatistics, javadoc indicates that IllegalArgumentException will be thrown if the region name could not be resolved. StatisticsImpl#getSecondLevelCacheStatistics throws IllegalArgumentException in this case (as documented). This is a regression. In 5.1, org.hibernate.stat.Statistics#getSecondLevelCacheStatistics, null is returned, although this is not documented in the API. In master, Javadoc for Statistics#getCacheRegionStatistics says null will be returned if there is no region with the specified name; IllegalArgumentException is thrown in this case. In master, StatisticsImpl#getNaturalIdStatistics throws IllegalArgumentException if the entity does not have a natural ID. In master, getDomainDataRegionStatistics throws IllegalArgumentException if the region can't be resolved or the region is a QueryResultsRegion. |