*BF [ 1874419 ] JDBC Statement not close in a finally block

organize imports
This commit is contained in:
Redhuan D. Oon 2008-02-19 10:30:35 +00:00
parent 2958febdbe
commit e956f4561f
1 changed files with 36 additions and 23 deletions

View File

@ -14,20 +14,39 @@
package org.compiere.pos; package org.compiere.pos;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; import java.awt.Dimension;
import java.math.*; import java.awt.Event;
import java.sql.*; import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.*; import javax.swing.Box;
import javax.swing.border.*; import javax.swing.BoxLayout;
import javax.swing.KeyStroke;
import javax.swing.border.TitledBorder;
import org.compiere.swing.*; import org.compiere.grid.ed.VNumber;
import org.compiere.grid.ed.*; import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.*; import org.compiere.minigrid.IDColumn;
import org.compiere.model.*; import org.compiere.minigrid.MiniTable;
import org.compiere.util.*; import org.compiere.model.MOrder;
import org.compiere.model.PO;
import org.compiere.swing.CButton;
import org.compiere.swing.CLabel;
import org.compiere.swing.CPanel;
import org.compiere.swing.CScrollPane;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/** /**
@ -239,30 +258,24 @@ public class SubLines extends PosSubPanel implements ActionListener
} }
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (m_sql, null); pstmt = DB.prepareStatement (m_sql, null);
pstmt.setInt (1, C_Order_ID); pstmt.setInt (1, C_Order_ID);
ResultSet rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
m_table.loadTable(rs); m_table.loadTable(rs);
rs.close ();
pstmt.close ();
pstmt = null;
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, m_sql, e); log.log(Level.SEVERE, m_sql, e);
} }
try finally
{ {
if (pstmt != null) DB.close(rs, pstmt);
pstmt.close (); rs = null; pstmt = null;
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
} }
setSums(order); setSums(order);
} // updateTable } // updateTable