diff --git a/base/src/org/compiere/model/MInventory.java b/base/src/org/compiere/model/MInventory.java index c2625e4c7f..ebb10673e7 100644 --- a/base/src/org/compiere/model/MInventory.java +++ b/base/src/org/compiere/model/MInventory.java @@ -121,28 +121,23 @@ public class MInventory extends X_M_Inventory implements DocAction ArrayList list = new ArrayList(); String sql = "SELECT * FROM M_InventoryLine WHERE M_Inventory_ID=? ORDER BY Line"; PreparedStatement pstmt = null; + ResultSet rs = null; try { pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt.setInt (1, getM_Inventory_ID()); - ResultSet rs = pstmt.executeQuery (); + rs = pstmt.executeQuery (); while (rs.next ()) list.add (new MInventoryLine (getCtx(), rs, get_TrxName())); - rs.close (); - pstmt.close (); - pstmt = null; - } catch (Exception e) + } + 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_lines = new MInventoryLine[list.size ()];