*BF [ 1874419 ] JDBC Statement not close in a finally block
organize imports
This commit is contained in:
parent
b76998a7a2
commit
0498f82f20
|
@ -183,6 +183,7 @@ public class DunningRunCreate extends SvrProcess
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
PreparedStatement pstmt2 = null;
|
PreparedStatement pstmt2 = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
|
@ -199,7 +200,7 @@ public class DunningRunCreate extends SvrProcess
|
||||||
//
|
//
|
||||||
pstmt2 = DB.prepareStatement (sql2, get_TrxName());
|
pstmt2 = DB.prepareStatement (sql2, get_TrxName());
|
||||||
//
|
//
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
int C_Invoice_ID = rs.getInt(1);
|
int C_Invoice_ID = rs.getInt(1);
|
||||||
|
@ -251,29 +252,16 @@ public class DunningRunCreate extends SvrProcess
|
||||||
TimesDunned, DaysAfterLast);
|
TimesDunned, DaysAfterLast);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
pstmt2.close();
|
|
||||||
pstmt2 = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "addInvoices", e);
|
log.log(Level.SEVERE, "addInvoices", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null; pstmt2 = null;
|
||||||
if (pstmt2 != null)
|
|
||||||
pstmt2.close ();
|
|
||||||
pstmt = null;
|
|
||||||
pstmt2 = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
pstmt2 = null;
|
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
} // addInvoices
|
} // addInvoices
|
||||||
|
@ -341,6 +329,7 @@ public class DunningRunCreate extends SvrProcess
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
|
@ -351,7 +340,7 @@ public class DunningRunCreate extends SvrProcess
|
||||||
else if (p_C_BP_Group_ID != 0)
|
else if (p_C_BP_Group_ID != 0)
|
||||||
pstmt.setInt (3, p_C_BP_Group_ID);
|
pstmt.setInt (3, p_C_BP_Group_ID);
|
||||||
|
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
int C_Payment_ID = rs.getInt(1);
|
int C_Payment_ID = rs.getInt(1);
|
||||||
|
@ -367,23 +356,15 @@ public class DunningRunCreate extends SvrProcess
|
||||||
C_BPartner_ID);
|
C_BPartner_ID);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
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
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
} // addPayments
|
} // addPayments
|
||||||
|
|
Loading…
Reference in New Issue