diff options
author | Divesh Mirchandani <Divesh.Mirchandani@amdocs.com> | 2017-09-14 19:14:21 +0530 |
---|---|---|
committer | Divesh Mirchandani <Divesh.Mirchandani@amdocs.com> | 2017-09-18 17:26:38 +0530 |
commit | 396cb378ab8940b1adb8ba1adc656d0b4ad66f99 (patch) | |
tree | b4f6ddc8e7cdfe39bfcbdc75cff7e85c284c5b65 /openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib | |
parent | 27f5c2b105676eebb477714fd7323467151965d2 (diff) |
Fixed SONAR issues
Fixed blocker, critical, major & minor SONAR issues.
Issue-ID: SDC-343
Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926
Signed-off-by: dd4616 <Divesh.Mirchandani@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib')
4 files changed, 19 insertions, 6 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java index 4ecc26879a..93410bc581 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java @@ -28,6 +28,8 @@ import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.util.Set; import java.util.stream.Collectors; @@ -38,6 +40,8 @@ class CassandraNoSqlDbImpl implements NoSqlDb { private final String keySpace; private final MappingManager mappingManager; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public CassandraNoSqlDbImpl(Session session) { this.session = session; @@ -109,6 +113,7 @@ class CassandraNoSqlDbImpl implements NoSqlDb { .collect(Collectors.toSet()); return versions.stream().collect(Collectors.joining(",")); } catch (Exception e){ + log.debug("",e); return "Failed to retrieve version"; } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java index 7b9b2ca84f..4bc8262439 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java @@ -20,12 +20,13 @@ package org.openecomp.core.nosqldb.impl.cassandra; -import com.google.common.base.Optional; - import com.datastax.driver.core.Cluster; import com.datastax.driver.core.SSLOptions; import com.datastax.driver.core.Session; +import com.google.common.base.Optional; import org.openecomp.core.nosqldb.util.CassandraUtils; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.io.FileInputStream; import java.io.IOException; @@ -36,11 +37,14 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; -import java.util.Objects; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; public class CassandraSessionFactory { + + private static final Logger log = (Logger) LoggerFactory.getLogger + (CassandraSessionFactory.class.getName()); + public static Session getSession() { return ReferenceHolder.CASSANDRA; } @@ -112,7 +116,7 @@ public class CassandraSessionFactory { ctx.init(null, tmf.getTrustManagers(), new SecureRandom()); } catch (Exception exception) { - exception.printStackTrace(); + log.debug("",exception); } finally { if (tsf != null) { tsf.close(); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java index c00db41ed9..1f5e20fd0b 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java @@ -20,6 +20,8 @@ package org.openecomp.core.nosqldb.util; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.services.YamlUtil; import java.io.FileInputStream; @@ -58,6 +60,8 @@ public class ConfigurationManager { private static ConfigurationManager instance = null; private final LinkedHashMap<String, Object> cassandraConfiguration; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private ConfigurationManager() { YamlUtil yamlUtil = new YamlUtil(); @@ -227,7 +231,7 @@ public class ConfigurationManager { try { is = new FileInputStream(file); } catch (FileNotFoundException exception) { - exception.printStackTrace(); + log.debug("",exception); } return is; } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java index fc96335daf..5c4f951a7b 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java @@ -32,7 +32,7 @@ import java.util.List; public class NoSqlDbTest { - private static NoSqlDb noSqlDb; + private NoSqlDb noSqlDb; /* @Test |