From 964f7da7f5a63b7ca5477bd27e26e73aa16daa92 Mon Sep 17 00:00:00 2001 From: ulrich <ulrich@uhilger.de> Date: Tue, 05 May 2015 05:39:29 +0000 Subject: [PATCH] AutoCommit bei commit und rollback in den finally-Zweig bewegt --- src/de/uhilger/baselink/PersistenceManager.java | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/de/uhilger/baselink/PersistenceManager.java b/src/de/uhilger/baselink/PersistenceManager.java index f3f8786..bd7ce34 100644 --- a/src/de/uhilger/baselink/PersistenceManager.java +++ b/src/de/uhilger/baselink/PersistenceManager.java @@ -893,7 +893,7 @@ try { c.setAutoCommit(false); } catch(SQLException ex) { - logger.log(Level.SEVERE, ex.getLocalizedMessage(), ex); + logger.log(Level.SEVERE, ex.getMessage(), ex); } finally { // .. } @@ -902,22 +902,28 @@ public void commit(Connection c) { try { c.commit(); - c.setAutoCommit(true); } catch(SQLException ex) { - logger.log(Level.SEVERE, ex.getLocalizedMessage(), ex); + logger.log(Level.SEVERE, ex.getMessage(), ex); } finally { - // ... + try { + c.setAutoCommit(true); + } catch (SQLException ex) { + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } public void rollback(Connection c) { try { c.rollback(); - c.setAutoCommit(true); } catch(SQLException ex) { logger.log(Level.SEVERE, ex.getLocalizedMessage(), ex); } finally { - // ... + try { + c.setAutoCommit(true); + } catch (SQLException ex) { + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } -- Gitblit v1.9.3