diff options
author | shashikanth <shashikanth.vh@huawei.com> | 2017-09-07 18:15:52 +0530 |
---|---|---|
committer | Shashikanth VH <shashikanth.vh@huawei.com> | 2017-09-08 09:10:39 +0000 |
commit | d74c0195215fd495fa37e4e3712f634f06e4e0b3 (patch) | |
tree | 8557f77b14d24d6f5df4a826be024ebadec9c5ec | |
parent | f28ba9bec18a636a9d5ecb38851f8af973e91f63 (diff) |
Fix Blocker/Critical sonar issues
Fix Blocker/Critical sonar issues in vnfapi module
https://sonar.onap.org/component_issues?id=org.onap.ccsdk.sli.core%3Accsdk-sli-core#severities=BLOCKER
Issue-Id: CCSDK-67
Change-Id: I9f1a7dc8144a2a3a777a2a4f24793bbf9317de33
Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
-rw-r--r-- | dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java index 9dc262d0..1729bcec 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java @@ -20,6 +20,18 @@ package org.onap.ccsdk.sli.core.dblib; +import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException; +import org.apache.tomcat.jdbc.pool.PoolExhaustedException; +import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration; +import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor; +import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor.TestObject; +import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitorObserver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.sql.DataSource; +import javax.sql.rowset.CachedRowSet; +import javax.sql.rowset.RowSetProvider; import java.io.Closeable; import java.io.IOException; import java.io.PrintWriter; @@ -36,20 +48,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Observer; -import javax.sql.DataSource; -import javax.sql.rowset.CachedRowSet; -import javax.sql.rowset.RowSetProvider; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.tomcat.jdbc.pool.PoolExhaustedException; -import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration; -import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor; -import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitorObserver; -import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor.TestObject; - -import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException; - /** * @version $Revision: 1.13 $ @@ -565,7 +563,9 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito retValue = false; } finally { try { - lock.close(); + if (lock != null) { + lock.close(); + } } catch(Exception exc) { } |