BF [ 1874419 ] JDBC Statement not close in a finally block
This commit is contained in:
parent
7821230d9c
commit
47ce11e65d
|
@ -18,9 +18,7 @@ package org.compiere.model;
|
||||||
|
|
||||||
import java.math.*;
|
import java.math.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
|
|
||||||
|
@ -60,11 +58,13 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
+ "FROM C_DocType d, AD_Sequence s "
|
+ "FROM C_DocType d, AD_Sequence s "
|
||||||
+ "WHERE C_DocType_ID=?" // 1
|
+ "WHERE C_DocType_ID=?" // 1
|
||||||
+ " AND d.DocNoSequence_ID=s.AD_Sequence_ID(+)";
|
+ " AND d.DocNoSequence_ID=s.AD_Sequence_ID(+)";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, C_DocType_ID.intValue());
|
pstmt.setInt(1, C_DocType_ID.intValue());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
// Charges - Set Context
|
// Charges - Set Context
|
||||||
|
@ -92,14 +92,16 @@ public class CalloutInvoice extends CalloutEngine
|
||||||
else if (s.endsWith("C"))
|
else if (s.endsWith("C"))
|
||||||
mTab.setValue("PaymentRule", "P"); // OnCredit
|
mTab.setValue("PaymentRule", "P"); // OnCredit
|
||||||
}
|
}
|
||||||
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 "";
|
return "";
|
||||||
} // docType
|
} // docType
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue