Skip to content

Commit

Permalink
update code.
Browse files Browse the repository at this point in the history
  • Loading branch information
billchen198318 committed Mar 22, 2019
1 parent 107ad01 commit fdcc3a7
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/*
* $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Expand All @@ -18,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.struts2.views.jasperreports;

import com.netsteadfast.greenstep.base.Constants;
Expand Down Expand Up @@ -289,7 +286,7 @@ protected void doExecute(String finalLocation, ActionInvocation invocation) thro
// TODO 更改 systemId 的位址
if (Constants.JASPER_REPORTS_RESULT_LOCATION_REPLACE_MODE) {
systemId = finalLocation;
}
}

Map parameters = new ValueStackShadowMap(stack);
File directory = new File(systemId.substring(0, systemId.lastIndexOf(File.separator)));
Expand Down Expand Up @@ -361,7 +358,7 @@ protected void doExecute(String finalLocation, ActionInvocation invocation) thro

Map imagesMap = new HashMap();
request.getSession(true).setAttribute("IMAGES_MAP", imagesMap);

// TODO : 改為jasperreport-6.5.1 版本使用的HtmlExporter , 原本: exporter = new JRHtmlExporter();
exporter = new HtmlExporter();
exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);
Expand Down Expand Up @@ -395,7 +392,10 @@ protected void doExecute(String finalLocation, ActionInvocation invocation) thro
throw new ServletException(e.getMessage(), e);
} finally {
try {
conn.close();
if (conn != null) {
// avoid NPE if connection was not used for the report
conn.close();
}
} catch (Exception e) {
LOG.warn("Could not close db connection properly", e);
}
Expand Down

0 comments on commit fdcc3a7

Please sign in to comment.