Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0022737Openbravo ERPA. Platformpublic2013-01-08 13:222013-01-18 20:26
mtaal 
mtaal 
normalminorhave not tried
closedfixed 
5
3.0MP18.1 
3.0MP203.0MP20 
AugustoMauch
Core
No
0022737: Close preparedstatement in DalSessionFactory
The DalSessionFactory.openSession creates a preparedstatement but does not close it. This should be done.
DalSessionFactory.openSession check the code
Close the preparedstatement in a finally statement:

      PreparedStatement pstmt = null;
      try {
        final String dbSessionConfig = props.getProperty("bbdd.sessionConfig");
        pstmt = conn.prepareStatement(dbSessionConfig);
        pstmt.executeQuery();
      } catch (Exception e) {
        throw new IllegalStateException(e);
      } finally {
        try {
          if (pstmt != null && !pstmt.isClosed()) {
            pstmt.close();
          }
        } catch (SQLException e) {
          throw new OBException(e);
        }
      }
No tags attached.
related to defect 00229233.0MP20 closed mtaal Cursors not closed 
Issue History
2013-01-08 13:22mtaalNew Issue
2013-01-08 13:22mtaalAssigned To => mtaal
2013-01-08 13:22mtaalModules => Core
2013-01-08 13:22mtaalTriggers an Emergency Pack => No
2013-01-08 13:22mtaalReview Assigned To => AugustoMauch
2013-01-09 09:28AugustoMauchTarget Version3.0MP19 => 3.0MP20
2013-01-14 10:48AugustoMauchStatusnew => scheduled
2013-01-14 10:48AugustoMauchfix_in_branch => pi
2013-01-16 13:37hgbotCheckin
2013-01-16 13:37hgbotNote Added: 0055545
2013-01-16 13:37hgbotStatusscheduled => resolved
2013-01-16 13:37hgbotResolutionopen => fixed
2013-01-16 13:37hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9b99a04c51e9ff85b095f7b1eb7bdb2f8a26e7e1 [^]
2013-01-17 16:21AugustoMauchNote Added: 0055572
2013-01-17 16:21AugustoMauchStatusresolved => closed
2013-01-17 16:21AugustoMauchFixed in Version => 3.0MP20
2013-01-18 20:26hudsonbotCheckin
2013-01-18 20:26hudsonbotNote Added: 0055634
2013-01-29 15:55egoitzRelationship addedrelated to 0022923

Notes
(0055545)
hgbot   
2013-01-16 13:37   
Repository: erp/devel/pi
Changeset: 9b99a04c51e9ff85b095f7b1eb7bdb2f8a26e7e1
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Wed Jan 16 13:37:25 2013 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/9b99a04c51e9ff85b095f7b1eb7bdb2f8a26e7e1 [^]

Fixes issue 22737: Close preparedstatement in DalSessionFactory
Correctly close the statement in a finally block

---
M src/org/openbravo/dal/core/DalSessionFactory.java
---
(0055572)
AugustoMauch   
2013-01-17 16:21   
Code reviewed and verified in pi@45700993c14c
(0055634)
hudsonbot   
2013-01-18 20:26   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/4cd4a6cc38e0 [^]

Maturity status: Test