Fixed DAO connection close issue.

This commit is contained in:
harshanl 2015-12-16 15:28:51 +05:30
parent f0669887fb
commit cb1c0c0439

View File

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