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

This commit is contained in:
Redhuan D. Oon 2008-02-19 06:26:45 +00:00
parent 78972aabd0
commit dcc794fddc
1 changed files with 5 additions and 13 deletions

View File

@ -432,33 +432,25 @@ public class WebInfo
+ " AND (C_BPartner_ID=?" + " AND (C_BPartner_ID=?"
+ " OR SalesRep_ID IN (SELECT AD_User_ID FROM AD_User WHERE C_BPartner_ID=?))"; + " OR SalesRep_ID IN (SELECT AD_User_ID FROM AD_User WHERE C_BPartner_ID=?))";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, m_id); pstmt.setInt(1, m_id);
pstmt.setInt(2, getC_BPartner_ID()); pstmt.setInt(2, getC_BPartner_ID());
pstmt.setInt(3, getC_BPartner_ID()); pstmt.setInt(3, getC_BPartner_ID());
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
retValue = new MRequest (m_ctx, rs, null); retValue = new MRequest (m_ctx, rs, null);
rs.close(); }
pstmt.close();
pstmt = null;
}
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, "R_Request_ID=" + m_id, e); log.log(Level.SEVERE, "R_Request_ID=" + m_id, e);
} }
finally finally
{ {
try DB.close(rs, pstmt);
{ rs = null; pstmt = null;
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
} }
log.fine("R_Request_ID=" + m_id + " - " + retValue); log.fine("R_Request_ID=" + m_id + " - " + retValue);
return retValue; return retValue;