BF [ 1874419 ] JDBC Statement not close in a finally block - fixed for MChangeLog

* reorganize imports
This commit is contained in:
teo_sarca 2008-02-04 23:12:49 +00:00
parent 751ef01796
commit b0a302589c
1 changed files with 12 additions and 16 deletions

View File

@ -16,9 +16,13 @@
*****************************************************************************/
package org.compiere.model;
import java.sql.*;
import java.util.logging.*;
import org.compiere.util.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
* Maintain AD_Table_ID/Record_ID contraint
@ -175,31 +179,23 @@ public class PO_Record
{
String sql = "SELECT AD_Table_ID, TableName FROM AD_Table WHERE IsView='N' ORDER BY 2";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, null);
ResultSet rs = pstmt.executeQuery ();
rs = pstmt.executeQuery ();
while (rs.next ())
{
validate (rs.getInt(1), rs.getString(2));
}
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log (Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
} // validate