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

*Organize imports
This commit is contained in:
Redhuan D. Oon 2008-02-08 19:25:19 +00:00
parent a35c729673
commit 4aa01e3459
1 changed files with 9 additions and 24 deletions

View File

@ -43,30 +43,23 @@ public class MAsset extends X_A_Asset
MAsset retValue = null;
String sql = "SELECT * FROM A_Asset WHERE M_InOutLine_ID=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, trxName);
pstmt.setInt (1, M_InOutLine_ID);
ResultSet rs = pstmt.executeQuery ();
rs = pstmt.executeQuery ();
if (rs.next ())
retValue = new MAsset (ctx, rs, trxName);
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
s_log.log (Level.SEVERE, sql, e);
}
try
finally
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
return retValue;
} // getFromShipment
@ -260,16 +253,14 @@ public class MAsset extends X_A_Asset
String sql = "SELECT * FROM A_Asset_Delivery WHERE A_Asset_ID=? ORDER BY Created DESC";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, get_TrxName());
pstmt.setInt(1, getA_Asset_ID());
ResultSet rs = pstmt.executeQuery();
rs = pstmt.executeQuery();
while (rs.next())
list.add(new MAssetDelivery(getCtx(), rs, get_TrxName()));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
@ -277,14 +268,8 @@ public class MAsset extends X_A_Asset
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
//
MAssetDelivery[] retValue = new MAssetDelivery[list.size()];