BF [ 1874419 ] JDBC Statement not close in a finally block
This commit is contained in:
parent
705c78d33d
commit
09a3263b6c
|
@ -41,30 +41,22 @@ public class MBPartnerLocation extends X_C_BPartner_Location
|
||||||
ArrayList<MBPartnerLocation> list = new ArrayList<MBPartnerLocation>();
|
ArrayList<MBPartnerLocation> list = new ArrayList<MBPartnerLocation>();
|
||||||
String sql = "SELECT * FROM C_BPartner_Location WHERE C_BPartner_ID=?";
|
String sql = "SELECT * FROM C_BPartner_Location 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, C_BPartner_ID);
|
pstmt.setInt (1, C_BPartner_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add(new MBPartnerLocation(ctx, rs, null));
|
list.add(new MBPartnerLocation(ctx, rs, null));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "getForBPartner", e);
|
s_log.log(Level.SEVERE, "getForBPartner", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
MBPartnerLocation[] retValue = new MBPartnerLocation[list.size ()];
|
MBPartnerLocation[] retValue = new MBPartnerLocation[list.size ()];
|
||||||
list.toArray (retValue);
|
list.toArray (retValue);
|
||||||
|
|
Loading…
Reference in New Issue