From b7375b2488df93ba9df57ad13ec628bbff663819 Mon Sep 17 00:00:00 2001 From: vempo Date: Thu, 7 Sep 2017 10:52:29 +0300 Subject: 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 --- .../src/main/java/org/openecomp/core/util/UniqueValueUtil.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api') diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java index d2dee5e512..dce34a1c96 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/main/java/org/openecomp/core/util/UniqueValueUtil.java @@ -27,7 +27,6 @@ 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.common.utils.CommonUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import java.util.Optional; @@ -95,9 +94,10 @@ public class UniqueValueUtil { mdcDataDebugMessage.debugEntryMessage(null, null); - if ((newValue != null && oldValue != null - && !newValue.toLowerCase().equals(oldValue.toLowerCase())) - || newValue == null || oldValue == null) { + boolean nonEqual = (newValue != null) && (oldValue != null) + && !newValue.toLowerCase().equals(oldValue.toLowerCase()); + + if (nonEqual || newValue == null || oldValue == null) { createUniqueValue(type, CommonMethods.concat(uniqueContext, new String[]{newValue})); deleteUniqueValue(type, CommonMethods.concat(uniqueContext, new String[]{oldValue})); } -- cgit 1.2.3-korg