From faaa1a75d85a522847acf4c7250b8da5f076cfa0 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 28 May 2019 09:15:39 -0400 Subject: Revert "Fixed sonar fix in DataSourceWrap.java" This reverts commit 6c1dee5b7d0e66338100c65efd51917d4f69998f. Sonar gave bad advice - this change causes connection to be closed on return to caller, which is useless. Change-Id: Id428c9058b5e33d72d58bbd951e6cdac2d2d151d Signed-off-by: Timoney, Dan (dt5972) --- .../ccsdk/sli/adaptors/util/db/DataSourceWrap.java | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java index 259b9d8d..2aebb83e 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java @@ -4,7 +4,6 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. - * Modifications Copyright (C) 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,22 +74,25 @@ public class DataSourceWrap implements DataSource { @Override public Connection getConnection() throws SQLException { - try (Connection c = dataSource.getConnection()){ - log.debug("getConnection: " + c.getClass().getName()); - c.setAutoCommit(true); - return c; - } + Connection c = dataSource.getConnection(); + + log.debug("getConnection: " + c.getClass().getName()); + + c.setAutoCommit(true); + return c; } + @Override public Connection getConnection(String username, String password) throws SQLException { - try (Connection c = dataSource.getConnection(username, password)){ - log.debug("getConnection: " + c.getClass().getName()); - c.setAutoCommit(true); - return c; - } + Connection c = dataSource.getConnection(username, password); + + log.debug("getConnection: " + c.getClass().getName()); + + c.setAutoCommit(true); + return c; } - public void setDataSource(DataSource dataSource) { + public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } } -- cgit 1.2.3-korg