diff options
author | k.kedron <k.kedron@partner.samsung.com> | 2019-06-04 16:21:03 +0200 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2019-06-11 06:38:06 +0000 |
commit | 3a98ad373d3f8a8cccce36f78e24bd24278043d6 (patch) | |
tree | 252377d7610edd465bcff1b85adb61d87f4b8921 /common/onap-common-configuration-management/onap-configuration-management-core/src/main | |
parent | 0d29f9d83ef3de89ea59622be7fe045ac0eed5f8 (diff) |
Improve unit test in the NonConfigResourceTest and various sonar fixes.
Improve the NonConfigResourceTest.
Remove the throws the Exception in CliConfigurationImp constructor.
ConfigurationImpl class:
- Replace the string to chart in indexOf method.
- Extract the assigment out from expression
Issue-ID: SDC-2327
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: If72a75e6a2d81a9ea74e3ae1af94b16a8489a29a
Diffstat (limited to 'common/onap-common-configuration-management/onap-configuration-management-core/src/main')
2 files changed, 7 insertions, 5 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java index 03b2075bac..a2440b9e94 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java @@ -41,7 +41,7 @@ public final class CliConfigurationImpl extends ConfigurationImpl implements Con private static final List<String> KEYS_TO_FILTER = Arrays.asList(NAMESPACE_KEY, MODE_KEY, LOAD_ORDER_KEY); - public CliConfigurationImpl() throws Exception { + public CliConfigurationImpl() { super(); } diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java index c51c8621a9..6cad62ef03 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java @@ -207,7 +207,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration { String k = keys.next(); if (k.startsWith(key + ".")) { k = k.substring(key.length() + 1); - String subkey = k.substring(0, k.indexOf(".")); + String subkey = k.substring(0, k.indexOf('.')); if (!map.containsKey(subkey)) { map.put(subkey, get(tenantId, namespace, key + "." + subkey, clazz)); } @@ -248,10 +248,12 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration { while (k.contains(".")) { if (k.contains(".")) { - String subkey = k.substring(0, k.indexOf(".")); - k = k.substring(k.indexOf(".") + 1); + String subkey = k.substring(0, k.indexOf('.')); + k = k.substring(k.indexOf('.') + 1); if (!map.containsKey(subkey)) { - map.put(subkey, map = new HashMap<>()); + Map tmp = new HashMap(); + map.put(subkey, tmp); + map = tmp; } else { map = (Map) map.get(subkey); } |