diff --git a/base/src/org/compiere/model/MWindow.java b/base/src/org/compiere/model/MWindow.java index d5d8d7d0ab..df421d8d37 100644 --- a/base/src/org/compiere/model/MWindow.java +++ b/base/src/org/compiere/model/MWindow.java @@ -16,12 +16,16 @@ *****************************************************************************/ package org.compiere.model; -import java.awt.*; -import java.sql.*; -import java.util.*; -import java.util.logging.*; +import java.awt.Dimension; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; -import org.compiere.util.*; +import org.compiere.util.CLogger; +import org.compiere.util.DB; /** * Window Model @@ -92,30 +96,23 @@ public class MWindow extends X_AD_Window String sql = "SELECT * FROM AD_Tab WHERE AD_Window_ID=? ORDER BY SeqNo"; ArrayList list = new ArrayList(); PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement (sql, trxName); pstmt.setInt (1, getAD_Window_ID()); - ResultSet rs = pstmt.executeQuery (); + rs = pstmt.executeQuery (); while (rs.next ()) list.add (new MTab (getCtx(), rs, trxName)); - rs.close (); - pstmt.close (); - pstmt = null; } catch (Exception e) { log.log(Level.SEVERE, sql, e); } - try + finally { - if (pstmt != null) - pstmt.close (); - pstmt = null; - } - catch (Exception e) - { - pstmt = null; + DB.close(rs, pstmt); + rs = null; pstmt = null; } // m_tabs = new MTab[list.size ()];