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:16:05 +00:00
parent b0a302589c
commit 432cfe0bc9
1 changed files with 19 additions and 18 deletions

View File

@ -16,12 +16,20 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.io.*; import java.io.Serializable;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.*; import java.sql.ResultSet;
import java.util.logging.*; import java.sql.SQLException;
import org.compiere.util.*; import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
/** /**
* Persistet Object Info. * Persistet Object Info.
@ -142,11 +150,12 @@ public class POInfo implements Serializable
sql.append(" AND e.AD_Language='").append(Env.getAD_Language(m_ctx)).append("'"); sql.append(" AND e.AD_Language='").append(Env.getAD_Language(m_ctx)).append("'");
// //
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sql.toString(), trxName); pstmt = DB.prepareStatement(sql.toString(), trxName);
pstmt.setInt(1, m_AD_Table_ID); pstmt.setInt(1, m_AD_Table_ID);
ResultSet rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
if (m_TableName == null) if (m_TableName == null)
@ -184,22 +193,14 @@ public class POInfo implements Serializable
IsTranslated, IsEncrypted); IsTranslated, IsEncrypted);
list.add(col); list.add(col);
} }
rs.close();
} }
catch (SQLException e) catch (SQLException e)
{ {
CLogger.get().log(Level.SEVERE, sql.toString(), e); CLogger.get().log(Level.SEVERE, sql.toString(), e);
} }
finally finally {
{ DB.close(rs, pstmt);
if( pstmt != null) rs = null; pstmt = null;
{
try
{
pstmt.close();
}
catch (SQLException e) {}
}
} }
// convert to array // convert to array
m_columns = new POInfoColumn[list.size()]; m_columns = new POInfoColumn[list.size()];