diff options
author | 2018-08-14 19:56:23 +0000 | |
---|---|---|
committer | 2018-08-14 19:56:23 +0000 | |
commit | d25fc43a67643f95a09ce347b3a4d4b551e51f94 (patch) | |
tree | 4930260b8e6fd4cedd744193f8b0c6f0d4b30329 /ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java | |
parent | 9ddac93ed79931d674d1b877661a0f7611d3a7d9 (diff) | |
parent | 4ffef33d70eb172fb594e8b50eabaf2b59d7f936 (diff) |
Merge "Fix use try-with-resources issues"
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java index d87a5b13..e976f144 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java @@ -1995,11 +1995,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { String insertQry = Globals.getDownloadAllInsert(); - Connection connection = null; - PreparedStatement pst = null; - try { - connection = DbUtils.getConnection(); - pst = connection.prepareStatement(insertQry); + try(Connection connection = DbUtils.getConnection(); + PreparedStatement pst = connection.prepareStatement(insertQry)){ if(nvl(emailId).length()>0){ pst.setInt(1, Integer.parseInt(userId)); pst.setInt(2, Integer.parseInt(rr.getReportID())); @@ -2019,8 +2016,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { connection.commit(); } } - pst.close(); - connection.close(); logger.debug(EELFLoggerDelegate.debugLogger, ("Data inserted")); } catch (SQLException ex) { throw new RaptorException(ex); @@ -2028,16 +2023,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { throw new RaptorException(ex); } catch (Exception ex) { throw new RaptorException (ex); - } finally { - try { - if(connection!=null) - connection.close(); - if(pst!=null) - pst.close(); - } catch (SQLException ex) { - throw new RaptorException(ex); - } - } + } //DbUtils.commitTransaction(connection); //DbUtils.clearConnection(connection); |