Zhong Hao (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiN2M4ZTMzOWUz...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16524?atlOrigin=eyJpIjoiN2M4ZT...
) HHH-16524 (
https://hibernate.atlassian.net/browse/HHH-16524?atlOrigin=eyJpIjoiN2M4ZT...
) StrategyCreatorRegionFactoryImpl throws an inconsitent exception (
https://hibernate.atlassian.net/browse/HHH-16524?atlOrigin=eyJpIjoiN2M4ZT...
)
Issue Type: Bug Affects Versions: 6.2.1 Assignee: Unassigned Components: hibernate-core
Created: 26/Apr/2023 22:12 PM Environment:
Priority: Major Reporter: Zhong Hao (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
When StrategyCreatorRegionFactoryImpl fails to create a class, it throws
ServiceException:
public RegionFactory create(Class<? extends RegionFactory> strategyClass) {
...
// finally try no-arg
try {
return strategyClass.newInstance();
}
catch (IllegalAccessException | InstantiationException e) {
throw new ServiceException( "Unable to call constructor of RegionFactory impl
[" + strategyClass.getName() + "]", e );
}
}
The other classes throw HibernateException. For example, SessionFactoryOptionsBuilder.java
has the following code:
private static Supplier<? extends Interceptor> interceptorSupplier(Class<?
extends Interceptor> clazz) {
return () -> {
try {
return clazz.newInstance();
}
catch (InstantiationException | IllegalAccessException e) {
throw new HibernateException( "Could not supply session-scoped SessionFactory
Interceptor", e );
}
};
}
SessionFactoryOptions.java is another example:
default Supplier<? extends Interceptor> getStatelessInterceptorImplementorSupplier()
{
return () -> {
try {
return getStatelessInterceptorImplementor().newInstance();
}
catch (InstantiationException | IllegalAccessException e) {
throw new HibernateException( "Could not supply session-scoped SessionFactory
Interceptor", e );
}
};
}
Can hibernate fix the problem? If calling code catches HibernateException , it will miss
the exceptions thrown by StrategyCreatorRegionFactoryImpl.
(
https://hibernate.atlassian.net/browse/HHH-16524#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16524#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100223- sha1:02266b8 )