mirror of
https://github.com/apache/struts.git
synced 2026-08-06 15:17:00 +00:00
WW-4923 Null check to avoid NPE when not passing a JDBC connection to the jasper report
This commit is contained in:
+4
-1
@@ -384,7 +384,10 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user