Affects: Spring Boot 6.0.4
In the SharedEntityManagerCreator class, the following code block invokes getOutputParameterValue which can throw a HibernateException.
|
try { |
|
Object key = entry.getKey(); |
|
if (key instanceof Integer number) { |
|
entry.setValue(storedProc.getOutputParameterValue(number)); |
|
} |
|
else { |
|
entry.setValue(storedProc.getOutputParameterValue(key.toString())); |
|
} |
|
} |
|
catch (IllegalArgumentException ex) { |
|
entry.setValue(ex); |
|
} |
The problem is that the catch block only handles IllegalArgumentException.
This causes a connection leak in the HikariCP pool because the subsequent EntityManagerFactoryUtils.closeEntityManager(this.entityManager); line will never be executed, and the entity manager will never be closed.
A possible solution is to change the catch block to handle the more general Exception or RuntimeException instead of IllegalArgumentException.
Affects: Spring Boot 6.0.4
In the
SharedEntityManagerCreatorclass, the following code block invokesgetOutputParameterValuewhich can throw aHibernateException.spring-framework/spring-orm/src/main/java/org/springframework/orm/jpa/SharedEntityManagerCreator.java
Lines 424 to 435 in 800b134
The problem is that the catch block only handles
IllegalArgumentException.This causes a connection leak in the HikariCP pool because the subsequent
EntityManagerFactoryUtils.closeEntityManager(this.entityManager);line will never be executed, and the entity manager will never be closed.A possible solution is to change the catch block to handle the more general
ExceptionorRuntimeExceptioninstead ofIllegalArgumentException.