*BF [ 1874419 ] JDBC Statement not close in a finally block
Organize Imports
This commit is contained in:
parent
a1dec79980
commit
f73b7e164b
|
@ -16,13 +16,19 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.process;
|
package org.compiere.process;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.*;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.*;
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.MClient;
|
||||||
import org.compiere.util.*;
|
import org.compiere.model.MSequence;
|
||||||
|
import org.compiere.util.CLogMgt;
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Trx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System + Document Sequence Check
|
* System + Document Sequence Check
|
||||||
|
@ -94,10 +100,11 @@ public class SequenceCheck extends SvrProcess
|
||||||
+ " AND NOT EXISTS (SELECT * FROM AD_Sequence s "
|
+ " AND NOT EXISTS (SELECT * FROM AD_Sequence s "
|
||||||
+ "WHERE UPPER(s.Name)=UPPER(t.TableName) AND s.IsTableID='Y')";
|
+ "WHERE UPPER(s.Name)=UPPER(t.TableName) AND s.IsTableID='Y')";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, trxName);
|
pstmt = DB.prepareStatement(sql, trxName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
String tableName = rs.getString(1);
|
String tableName = rs.getString(1);
|
||||||
|
@ -114,23 +121,15 @@ public class SequenceCheck extends SvrProcess
|
||||||
throw new Exception ("Error creating Table Sequence for " + tableName);
|
throw new Exception ("Error creating Table Sequence for " + tableName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null; pstmt = null;
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sync Table Name case
|
// Sync Table Name case
|
||||||
|
@ -161,30 +160,22 @@ public class SequenceCheck extends SvrProcess
|
||||||
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 ())
|
||||||
{
|
{
|
||||||
String TableName = rs.getString(1);
|
String TableName = rs.getString(1);
|
||||||
String SeqName = rs.getString(2);
|
String SeqName = rs.getString(2);
|
||||||
sp.addLog(0, null, null, "ERROR: TableName=" + TableName + " - Sequence=" + SeqName);
|
sp.addLog(0, null, null, "ERROR: TableName=" + TableName + " - Sequence=" + SeqName);
|
||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
} // checkTableSequences
|
} // checkTableSequences
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue