diff --git a/posterita/src/main/org/posterita/businesslogic/CashManager.java b/posterita/src/main/org/posterita/businesslogic/CashManager.java index 114d1acd66..3b15820612 100644 --- a/posterita/src/main/org/posterita/businesslogic/CashManager.java +++ b/posterita/src/main/org/posterita/businesslogic/CashManager.java @@ -497,6 +497,7 @@ public class CashManager + " AND c.docstatus='DR'"; PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement (sql, trxName); @@ -504,7 +505,7 @@ public class CashManager pstmt.setInt (1, C_CashBook_ID); //pstmt.setTimestamp (2, TimeUtil.getDay(dateAcct)); - ResultSet rs = pstmt.executeQuery (); + rs = pstmt.executeQuery (); if (rs.next ()) retValue = new MCash (ctx, rs, trxName); rs.close (); @@ -513,19 +514,11 @@ public class CashManager { throw new OperationException(e); } - finally - { - try - { - if (pstmt != null) - pstmt.close (); - - } - catch (Exception e) - {} - - pstmt = null; - } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } return retValue; @@ -638,7 +631,7 @@ public class CashManager + " AND TRUNC(c.StatementDate)