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

organize imports
This commit is contained in:
Redhuan D. Oon 2008-07-03 14:38:27 +00:00
parent c4d792b425
commit ca5a97280c
1 changed files with 15 additions and 22 deletions

View File

@ -13,11 +13,17 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.FA; package org.compiere.FA;
import java.sql.*;
import org.compiere.process.*;
import org.compiere.model.*;
import org.compiere.util.DB;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.compiere.model.MAssetChange;
import org.compiere.model.MRefList_Ext;
import org.compiere.model.X_A_Asset_Disposed;
import org.compiere.model.X_A_Depreciation_Exp;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.util.DB;
/** /**
@ -101,11 +107,9 @@ public class AssetDisposed extends SvrProcess
log.info("doIt - SQL=" + sql); log.info("doIt - SQL=" + sql);
String v_PostingType = null; String v_PostingType = null;
//X_A_Depreciation_Exp depexp = new X_A_Depreciation_Exp (getCtx(), 0, null); //X_A_Depreciation_Exp depexp = new X_A_Depreciation_Exp (getCtx(), 0, null);
ResultSet rs = null;
try { try {
rs = pstmt.executeQuery();
ResultSet rs = pstmt.executeQuery();
while (rs.next()){ while (rs.next()){
if (v_PostingType != rs.getString("PostingType") & v_PostingType != null) if (v_PostingType != rs.getString("PostingType") & v_PostingType != null)
{ {
@ -115,8 +119,6 @@ public class AssetDisposed extends SvrProcess
+ "AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + v_PostingType + "'"; + "AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + v_PostingType + "'";
DB.executeUpdate(sql,null); DB.executeUpdate(sql,null);
v_Balance = new BigDecimal("0.0"); v_Balance = new BigDecimal("0.0");
v_PostingType = rs.getString("PostingType"); v_PostingType = rs.getString("PostingType");
} }
@ -125,7 +127,6 @@ public class AssetDisposed extends SvrProcess
v_PostingType = rs.getString("PostingType"); v_PostingType = rs.getString("PostingType");
} }
// Create JV for the asset disposal - remove cost of asset on balance sheet // Create JV for the asset disposal - remove cost of asset on balance sheet
X_A_Depreciation_Exp depexp0 = new X_A_Depreciation_Exp (getCtx(), 0, null); X_A_Depreciation_Exp depexp0 = new X_A_Depreciation_Exp (getCtx(), 0, null);
depexp0.setPostingType(rs.getString("PostingType")); depexp0.setPostingType(rs.getString("PostingType"));
@ -203,9 +204,6 @@ public class AssetDisposed extends SvrProcess
change.setIsDisposed(true); change.setIsDisposed(true);
change.save(); change.save();
rs.close();
pstmt.close();
pstmt = null;
} }
catch (Exception e) catch (Exception e)
{ {
@ -213,14 +211,9 @@ public class AssetDisposed extends SvrProcess
} }
finally finally
{ {
try DB.close(rs, pstmt);
{ rs = null; pstmt = null;
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
} }
return ""; return "";