Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3462

connection open after report generation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.8
    • 2.3.28, 2.5
    • Plugin - JasperReports
    • None
    • jdk1.5.0_16

    • Patch

    Description

      If a report generation was called with connection like following code, database connection will not be closed. I suggest to modify doExecute method of org.apache.struts2.views.jasperreports.JasperReportsResult class after the exportReportToBytes, by adding, in case of conn not null, the conn closing.

      struts.xml
      ...
      <action name="report" class="myorg.actions.tests.Report">
      <result name="success" type="jasper">
      <param name="location">/test/Report.jasper</param>
      <param name="connection">myConnection</param>
      <param name="contentDisposition">attachment</param>
      <param name="format">PDF</param>
      </result>
      </action>
      ....

      Action execute method code
      ...
      DataSource ds = (DataSource) ictx.lookup("java:jdbc/myApp");
      myConnection = ds.getConnection();
      ...

      Attachments

        Activity

          People

            Unassigned Unassigned
            soteri Salva
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 20m
                20m
                Remaining:
                Remaining Estimate - 20m
                20m
                Logged:
                Time Spent - Not Specified
                Not Specified