diff options
author | 2018-07-27 11:17:36 +0900 | |
---|---|---|
committer | 2018-08-03 16:07:43 +0900 | |
commit | 4ffef33d70eb172fb594e8b50eabaf2b59d7f936 (patch) | |
tree | 70c954a312810e68238cb89d4708251be78c7270 /ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller | |
parent | 40a17c1d7e5f0edca350a49210e16223a875d290 (diff) |
Fix use try-with-resources issues
Fix in epsdk-analytics
Issue-ID: PORTAL-342
Change-Id: Ia13844c65fa23fbdea01e80091c1f8573cf7ad1f
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller')
-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); |