*BF [ 1874419 ] JDBC Statement not close in a finally block
Organize Imports
This commit is contained in:
parent
84ed404db1
commit
a1dec79980
|
@ -16,11 +16,21 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.util;
|
package org.compiere.util;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.*;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.*;
|
import java.sql.Timestamp;
|
||||||
import javax.servlet.http.*;
|
import java.util.Properties;
|
||||||
import org.compiere.model.*;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.compiere.model.MBPBankAccount;
|
||||||
|
import org.compiere.model.MBPartner;
|
||||||
|
import org.compiere.model.MBPartnerLocation;
|
||||||
|
import org.compiere.model.MLocation;
|
||||||
|
import org.compiere.model.MRefList;
|
||||||
|
import org.compiere.model.MUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web User Info.
|
* Web User Info.
|
||||||
|
@ -161,20 +171,18 @@ public class WebUser
|
||||||
email = "";
|
email = "";
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, m_AD_Client_ID);
|
pstmt.setInt(1, m_AD_Client_ID);
|
||||||
pstmt.setString(2, email.trim());
|
pstmt.setString(2, email.trim());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
m_bpc = new MUser (m_ctx, rs, null);
|
m_bpc = new MUser (m_ctx, rs, null);
|
||||||
log.fine("Found BPC=" + m_bpc);
|
log.fine("Found BPC=" + m_bpc);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -182,14 +190,8 @@ public class WebUser
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Password
|
// Check Password
|
||||||
|
@ -453,35 +455,27 @@ public class WebUser
|
||||||
{
|
{
|
||||||
String sql = "SELECT * FROM C_BPartner WHERE AD_Client_ID=? AND Value=?";
|
String sql = "SELECT * FROM C_BPartner WHERE AD_Client_ID=? AND Value=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt (1, m_AD_Client_ID);
|
pstmt.setInt (1, m_AD_Client_ID);
|
||||||
pstmt.setString (2, m_bp.getValue());
|
pstmt.setString (2, m_bp.getValue());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
m_bp = new MBPartner (m_ctx, m_bpc.getC_BPartner_ID (), null);
|
m_bp = new MBPartner (m_ctx, m_bpc.getC_BPartner_ID (), null);
|
||||||
log.fine("BP loaded =" + m_bp);
|
log.fine("BP loaded =" + m_bp);
|
||||||
}
|
}
|
||||||
rs.close();
|
}
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "save-check", e);
|
log.log(Level.SEVERE, "save-check", e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue