*BF [ 1874419 ] JDBC Statement not close in a finally block
organize imports
This commit is contained in:
parent
5be2325d6e
commit
2958febdbe
|
@ -16,16 +16,29 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.wstore;
|
package org.compiere.wstore;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.IOException;
|
||||||
import java.sql.*;
|
import java.io.PrintWriter;
|
||||||
import java.util.*;
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.servlet.ServletConfig;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import javax.servlet.*;
|
import org.compiere.model.MBPartner;
|
||||||
import javax.servlet.http.*;
|
import org.compiere.model.MClient;
|
||||||
|
import org.compiere.model.MOrg;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.MWarehouse;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Util;
|
||||||
|
import org.compiere.util.WebEnv;
|
||||||
|
import org.compiere.util.WebUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Location Servlet
|
* Location Servlet
|
||||||
|
@ -412,35 +425,29 @@ public class SearchServlet extends HttpServlet
|
||||||
ArrayList<MBPartner> list = new ArrayList<MBPartner>();
|
ArrayList<MBPartner> list = new ArrayList<MBPartner>();
|
||||||
String sql = "SELECT * FROM C_BPartner";
|
String sql = "SELECT * FROM C_BPartner";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MBPartner partner = new MBPartner (ctx, rs, null);
|
MBPartner partner = new MBPartner (ctx, rs, null);
|
||||||
//s_cache.put (new Integer (partner.getAD_Client_ID()), partner);
|
//s_cache.put (new Integer (partner.getAD_Client_ID()), partner);
|
||||||
list.add (partner);
|
list.add (partner);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
//s_log.log(Level.SEVERE, sql, e);
|
//s_log.log(Level.SEVERE, sql, e);
|
||||||
log.severe(e.getMessage());
|
log.severe(e.getMessage());
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MBPartner[] retValue = new MBPartner[list.size ()];
|
MBPartner[] retValue = new MBPartner[list.size ()];
|
||||||
list.toArray (retValue);
|
list.toArray (retValue);
|
||||||
return retValue;
|
return retValue;
|
||||||
|
|
Loading…
Reference in New Issue