BF [ 1874419 ] JDBC Statement not close in a finally block
This commit is contained in:
parent
aa73374af2
commit
9064a1e62b
|
@ -75,14 +75,16 @@ public class CalloutPayment extends CalloutEngine
|
||||||
+ " invoiceOpen(C_Invoice_ID, ?)," // 3 #1
|
+ " invoiceOpen(C_Invoice_ID, ?)," // 3 #1
|
||||||
+ " invoiceDiscount(C_Invoice_ID,?,?), IsSOTrx " // 4..5 #2/3
|
+ " invoiceDiscount(C_Invoice_ID,?,?), IsSOTrx " // 4..5 #2/3
|
||||||
+ "FROM C_Invoice WHERE C_Invoice_ID=?"; // #4
|
+ "FROM C_Invoice WHERE C_Invoice_ID=?"; // #4
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, C_InvoicePaySchedule_ID);
|
pstmt.setInt(1, C_InvoicePaySchedule_ID);
|
||||||
pstmt.setTimestamp(2, ts);
|
pstmt.setTimestamp(2, ts);
|
||||||
pstmt.setInt(3, C_InvoicePaySchedule_ID);
|
pstmt.setInt(3, C_InvoicePaySchedule_ID);
|
||||||
pstmt.setInt(4, C_Invoice_ID.intValue());
|
pstmt.setInt(4, C_Invoice_ID.intValue());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
mTab.setValue("C_BPartner_ID", new Integer(rs.getInt(1)));
|
mTab.setValue("C_BPartner_ID", new Integer(rs.getInt(1)));
|
||||||
|
@ -101,14 +103,16 @@ public class CalloutPayment extends CalloutEngine
|
||||||
Env.setContext(ctx, WindowNo, "C_Invoice_ID", C_Invoice_ID.toString());
|
Env.setContext(ctx, WindowNo, "C_Invoice_ID", C_Invoice_ID.toString());
|
||||||
mTab.setValue("C_Invoice_ID", C_Invoice_ID);
|
mTab.setValue("C_Invoice_ID", C_Invoice_ID);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return e.getLocalizedMessage();
|
return e.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
}
|
||||||
|
|
||||||
return docType(ctx, WindowNo, mTab, mField, value);
|
return docType(ctx, WindowNo, mTab, mField, value);
|
||||||
} // invoice
|
} // invoice
|
||||||
|
@ -150,11 +154,13 @@ public class CalloutPayment extends CalloutEngine
|
||||||
//
|
//
|
||||||
String sql = "SELECT C_BPartner_ID,C_Currency_ID, GrandTotal "
|
String sql = "SELECT C_BPartner_ID,C_Currency_ID, GrandTotal "
|
||||||
+ "FROM C_Order WHERE C_Order_ID=?"; // #1
|
+ "FROM C_Order WHERE C_Order_ID=?"; // #1
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, C_Order_ID.intValue());
|
pstmt.setInt(1, C_Order_ID.intValue());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
mTab.setValue("C_BPartner_ID", new Integer(rs.getInt(1)));
|
mTab.setValue("C_BPartner_ID", new Integer(rs.getInt(1)));
|
||||||
|
@ -166,14 +172,16 @@ public class CalloutPayment extends CalloutEngine
|
||||||
GrandTotal = Env.ZERO;
|
GrandTotal = Env.ZERO;
|
||||||
mTab.setValue("PayAmt", GrandTotal);
|
mTab.setValue("PayAmt", GrandTotal);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return e.getLocalizedMessage();
|
return e.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
}
|
||||||
|
|
||||||
return docType(ctx, WindowNo, mTab, mField, value);
|
return docType(ctx, WindowNo, mTab, mField, value);
|
||||||
} // order
|
} // order
|
||||||
|
|
Loading…
Reference in New Issue