Merge pull request #2318 from stianst/KEYCLOAK-2577

KEYCLOAK-2577 Rollback session in KeycloakSessionServletFilter if not…
This commit is contained in:
Stian Thorgersen 2016-03-03 10:33:29 +01:00
commit 2bf3531c43

View file

@ -77,6 +77,12 @@ public class KeycloakSessionServletFilter implements Filter {
try {
filterChain.doFilter(servletRequest, servletResponse);
} finally {
// KeycloakTransactionCommitter is responsible for committing the transaction, but if an exception is thrown it's not invoked and transaction
// should be rolled back
if (session.getTransaction() != null && session.getTransaction().isActive()) {
session.getTransaction().rollback();
}
session.close();
ResteasyProviderFactory.clearContextData();
}