diff options
author | Arun S. Yerra <arun.yerra@huawei.com> | 2017-09-07 11:09:06 -0700 |
---|---|---|
committer | Arun S. Yerra <arun.yerra@huawei.com> | 2017-09-07 22:28:38 -0700 |
commit | aa5441ed5a583c3b0c9e487108cd691310c1e78a (patch) | |
tree | 02f7e8c59ad2d958062bbe9da92310c4d556c462 /sliPluginUtils/provider/src | |
parent | de9f4a0a63e7eef6663a132b6ec565b49bbd01b6 (diff) |
Fix Sonar issues within SliPluginUtils module
Sonarqube report for SliPluginUtils identified some critical bugs. This fix will address these bugs.
Issue-Id: CCSDK-81
Change-Id: I9a1738c02f1364b17a0895b94f26c373e4a19f1f
Signed-off-by: Arun S. Yerra <arun.yerra@huawei.com>
Diffstat (limited to 'sliPluginUtils/provider/src')
-rw-r--r-- | sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java index e6811e789..488dc395b 100644 --- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java +++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java @@ -26,6 +26,7 @@ import java.io.FileOutputStream; import java.io.PrintStream; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -489,6 +490,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { switch( logLevel ) { case TRACE: log.trace(log_message); + break; case DEBUG: log.debug(log_message); break; @@ -648,6 +650,38 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { return 0; } + + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (!(object instanceof SortableCtxListElement)) { + return false; + } + if (!super.equals(object)) { + return false; + } + + SortableCtxListElement that = (SortableCtxListElement) object; + + if (child_elements != null ? !child_elements.equals(that.child_elements) + : that.child_elements != null) { + return false; + } + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(sort_fields, that.sort_fields)) { + return false; + } + + return true; + } + + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (child_elements != null ? child_elements.hashCode() : 0); + result = 31 * result + Arrays.hashCode(sort_fields); + return result; + } } /** |