diff --git a/base/src/org/compiere/print/DataEngine.java b/base/src/org/compiere/print/DataEngine.java index 63630f97c5..b077d681fe 100644 --- a/base/src/org/compiere/print/DataEngine.java +++ b/base/src/org/compiere/print/DataEngine.java @@ -29,7 +29,9 @@ import org.compiere.util.*; * @author Jorg Janke * @version $Id: DataEngine.java,v 1.3 2006/07/30 00:53:02 jjanke Exp $ * - * @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1761891 ] + * @author Teo Sarca, SC ARHIPAC SERVICE SRL + *
  • BF [ 1761891 ] Included print format with report view attached issue + *
  • BF [ 1807368 ] DataEngine does not close DB connection */ public class DataEngine { @@ -198,11 +200,13 @@ public class DataEngine + "WHERE pf.AD_PrintFormat_ID=?" // #1 + " AND pfi.IsActive='Y' AND (pfi.IsPrinted='Y' OR c.IsKey='Y' OR pfi.SortNo > 0) " + "ORDER BY pfi.IsPrinted DESC, pfi.SeqNo"; // Functions are put in first column + PreparedStatement pstmt = null; + ResultSet rs = null; try { - PreparedStatement pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, format.get_ID()); - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); m_synonym = "A"; // synonym while (rs.next()) @@ -519,6 +523,12 @@ public class DataEngine { log.log(Level.SEVERE, "SQL=" + sql + " - ID=" + format.get_ID(), e); } + finally { + DB.close(rs); + DB.close(pstmt); + rs = null; + pstmt = null; + } if (columns.size() == 0) {