Fixed DAO connection close issue.

revert-dabc3590
harshanl 9 years ago
parent f0669887fb
commit cb1c0c0439

@ -83,16 +83,15 @@ public class AndroidDAOFactory extends AbstractMobileDeviceManagementDAOFactory
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while committing the transaction", e); throw new MobileDeviceManagementDAOException("Error occurred while committing the transaction", e);
} finally {
closeConnection();
} }
} }
public static void closeConnection() throws MobileDeviceManagementDAOException { public static void closeConnection() throws MobileDeviceManagementDAOException {
Connection conn = currentConnection.get();
Connection con = currentConnection.get();
try { try {
con.close(); if (conn != null) {
conn.close();
}
} catch (SQLException e) { } catch (SQLException e) {
log.error("Error occurred while close the connection"); log.error("Error occurred while close the connection");
} }
@ -112,8 +111,6 @@ public class AndroidDAOFactory extends AbstractMobileDeviceManagementDAOFactory
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new MobileDeviceManagementDAOException("Error occurred while rollback the transaction", e); throw new MobileDeviceManagementDAOException("Error occurred while rollback the transaction", e);
} finally {
closeConnection();
} }
} }

Loading…
Cancel
Save