BF [ 1874419 ] JDBC Statement not close in a finally block
This commit is contained in:
parent
bcb3ff779a
commit
609f2e8f0e
|
@ -184,12 +184,13 @@ public class PAttributeInstance extends CDialog
|
||||||
+ " ON (bp.C_BPartner_ID=bpp.C_BPartner_ID AND bpp.M_Product_ID=?) "
|
+ " ON (bp.C_BPartner_ID=bpp.C_BPartner_ID AND bpp.M_Product_ID=?) "
|
||||||
+ "WHERE bp.C_BPartner_ID=?";
|
+ "WHERE bp.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_M_Product_ID);
|
pstmt.setInt(1, m_M_Product_ID);
|
||||||
pstmt.setInt(2, C_BPartner_ID);
|
pstmt.setInt(2, C_BPartner_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
ShelfLifeMinPct = rs.getInt(1); // BP
|
ShelfLifeMinPct = rs.getInt(1); // BP
|
||||||
|
@ -198,23 +199,14 @@ public class PAttributeInstance extends CDialog
|
||||||
ShelfLifeMinDays = pct;
|
ShelfLifeMinDays = pct;
|
||||||
ShelfLifeMinDays = rs.getInt(3);
|
ShelfLifeMinDays = rs.getInt(3);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally {
|
||||||
{
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null)
|
rs = null; pstmt = null;
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
if (ShelfLifeMinPct > 0)
|
if (ShelfLifeMinPct > 0)
|
||||||
{
|
{
|
||||||
|
@ -258,31 +250,23 @@ public class PAttributeInstance extends CDialog
|
||||||
//
|
//
|
||||||
log.finest(sql);
|
log.finest(sql);
|
||||||
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_M_Product_ID);
|
pstmt.setInt(1, m_M_Product_ID);
|
||||||
if (m_M_Warehouse_ID != 0)
|
if (m_M_Warehouse_ID != 0)
|
||||||
pstmt.setInt(2, m_M_Warehouse_ID);
|
pstmt.setInt(2, m_M_Warehouse_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
m_table.loadTable(rs);
|
m_table.loadTable(rs);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally {
|
||||||
{
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null)
|
rs = null; pstmt = null;
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
enableButtons();
|
enableButtons();
|
||||||
} // refresh
|
} // refresh
|
||||||
|
|
Loading…
Reference in New Issue