Some StatisticsImpl methods throw an exception instead of returning null

Description

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.

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Gail Badner

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure