diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2017-09-07 10:52:29 +0300 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2017-09-07 13:53:33 +0000 |
commit | b7375b2488df93ba9df57ad13ec628bbff663819 (patch) | |
tree | e8d372535ab98aa76814e16d301ac32efbeb0c75 /openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src | |
parent | 8bd8cee7d620406036e197f540439b1e226506d5 (diff) |
Fixed a few static analysis violations
Fixed mostly not closing resources (InputStream, ResultSet) and catching
Throwable instead of Exception in some modules.
Issue-ID: SDC-291
Change-Id: I34e331cc3b45c4bb3a71c301f50e1706a7b623fd
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src')
-rw-r--r-- | openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java index 2a88d0e521..7a70900873 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java @@ -23,7 +23,6 @@ package org.openecomp.core.nosqldb.util; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; -import java.io.InputStream; import java.util.HashMap; import java.util.Map; @@ -49,10 +48,12 @@ public class CassandraUtils { * @return the statement */ public static String getStatement(String statementName) { + if (statementMap.size() == 0) { - InputStream statementJson = FileUtils.getFileInputStream(CASSANDRA_STATEMENT_DEFINITION_FILE); - statementMap = JsonUtil.json2Object(statementJson, Map.class); + statementMap = FileUtils.readViaInputStream(CASSANDRA_STATEMENT_DEFINITION_FILE, + stream -> JsonUtil.json2Object(stream, Map.class)); } + return statementMap.get(statementName); } |