Mercurial > dive4elements > river
changeset 8573:5c53b7de04d9
The bug that motivated this extremely defensive error-handling was fixed in Rev fe7e9da6312a by nomore calling close() on a private variable.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 06 Mar 2015 11:21:36 +0100 |
parents | 321d6e50aebe |
children | c16d04f2c5bc |
files | backend/src/main/java/org/dive4elements/river/backend/SessionHolder.java |
diffstat | 1 files changed, 2 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/backend/SessionHolder.java Fri Mar 06 10:57:56 2015 +0100 +++ b/backend/src/main/java/org/dive4elements/river/backend/SessionHolder.java Fri Mar 06 11:21:36 2015 +0100 @@ -50,23 +50,9 @@ Session session = HOLDER.get(); if (session != null) { log.debug("releasing session: " + session.hashCode()); - try { - if (!session.isOpen()) { - /* If this check really works in all cases why does hibernate - * does not use it when you call close anyway. */ - log.debug("Session is not open. Calling close anyway."); - } - session.close(); - } catch (Exception e) { - /* Do not try this at home. But hibernate may fail with an NPE - * or any other exception depending on the state of the session. - * According to doc this should only throw a HibernateException but - * we definetely get NPE's here. - */ - log.error("Exception caught on session close! Session already closed?" + e.getMessage()); - } + session.close(); } else { - log.debug("release called on NULL session."); + log.error("release() called on NULL session."); } HOLDER.remove(); }