*BF [ 1874419 ] JDBC Statement not close in a finally block

organize imports
This commit is contained in:
Redhuan D. Oon 2008-02-19 12:57:45 +00:00
parent cf2793cae1
commit db3330ecbb
1 changed files with 14 additions and 28 deletions

View File

@ -497,6 +497,7 @@ public class CashManager
+ " AND c.docstatus='DR'"; + " AND c.docstatus='DR'";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql, trxName); pstmt = DB.prepareStatement (sql, trxName);
@ -504,7 +505,7 @@ public class CashManager
pstmt.setInt (1, C_CashBook_ID); pstmt.setInt (1, C_CashBook_ID);
//pstmt.setTimestamp (2, TimeUtil.getDay(dateAcct)); //pstmt.setTimestamp (2, TimeUtil.getDay(dateAcct));
ResultSet rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
if (rs.next ()) if (rs.next ())
retValue = new MCash (ctx, rs, trxName); retValue = new MCash (ctx, rs, trxName);
rs.close (); rs.close ();
@ -515,16 +516,8 @@ public class CashManager
} }
finally finally
{ {
try DB.close(rs, pstmt);
{ rs = null; pstmt = null;
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
} }
return retValue; return retValue;
@ -638,7 +631,7 @@ public class CashManager
+ " AND TRUNC(c.StatementDate)<?" + " AND TRUNC(c.StatementDate)<?"
+ " order by c.StatementDate asc"; + " order by c.StatementDate asc";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
MCash cash=null; MCash cash=null;
BigDecimal endingBalance=null; BigDecimal endingBalance=null;
try try
@ -647,7 +640,7 @@ public class CashManager
pstmt.setInt (1, cashBookId); pstmt.setInt (1, cashBookId);
pstmt.setTimestamp (2, TimeUtil.getDay(JulianDate.getTodayDateOnly())); pstmt.setTimestamp (2, TimeUtil.getDay(JulianDate.getTodayDateOnly()));
ResultSet rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
while(rs.next()) while(rs.next())
{ {
cash=new MCash(ctx,rs.getInt(1),null); cash=new MCash(ctx,rs.getInt(1),null);
@ -667,15 +660,8 @@ public class CashManager
} }
finally finally
{ {
try DB.close(rs, pstmt);
{ rs = null; pstmt = null;
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
} }
} }