*BF [ 1874419 ] JDBC Statement not close in a finally block
organize imports
This commit is contained in:
parent
f5061798f9
commit
9b2adb058e
|
@ -16,10 +16,21 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.process;
|
package org.compiere.process;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.logging.*;
|
import java.sql.ResultSet;
|
||||||
import org.compiere.model.*;
|
import java.sql.Timestamp;
|
||||||
import org.compiere.util.*;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.model.MBPartner;
|
||||||
|
import org.compiere.model.MDocType;
|
||||||
|
import org.compiere.model.MInvoice;
|
||||||
|
import org.compiere.model.MInvoiceLine;
|
||||||
|
import org.compiere.model.MTimeExpense;
|
||||||
|
import org.compiere.model.MTimeExpenseLine;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.DisplayType;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create AP Invoices from Expense Reports
|
* Create AP Invoices from Expense Reports
|
||||||
|
@ -85,6 +96,7 @@ public class ExpenseAPInvoice extends SvrProcess
|
||||||
MInvoice invoice = null;
|
MInvoice invoice = null;
|
||||||
//
|
//
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString (), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString (), get_TrxName());
|
||||||
|
@ -96,7 +108,7 @@ public class ExpenseAPInvoice extends SvrProcess
|
||||||
pstmt.setTimestamp (par++, m_DateFrom);
|
pstmt.setTimestamp (par++, m_DateFrom);
|
||||||
if (m_DateTo != null)
|
if (m_DateTo != null)
|
||||||
pstmt.setTimestamp (par++, m_DateTo);
|
pstmt.setTimestamp (par++, m_DateTo);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next()) // ********* Expense Line Loop
|
while (rs.next()) // ********* Expense Line Loop
|
||||||
{
|
{
|
||||||
MTimeExpense te = new MTimeExpense (getCtx(), rs, get_TrxName());
|
MTimeExpense te = new MTimeExpense (getCtx(), rs, get_TrxName());
|
||||||
|
@ -177,9 +189,6 @@ public class ExpenseAPInvoice extends SvrProcess
|
||||||
line.save();
|
line.save();
|
||||||
} // for all expense lines
|
} // for all expense lines
|
||||||
} // ********* Expense Line Loop
|
} // ********* Expense Line Loop
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -187,14 +196,8 @@ public class ExpenseAPInvoice extends SvrProcess
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
completeInvoice (invoice);
|
completeInvoice (invoice);
|
||||||
return "@Created@=" + m_noInvoices;
|
return "@Created@=" + m_noInvoices;
|
||||||
|
|
Loading…
Reference in New Issue