diff options
author | xuegao <xg353y@intl.att.com> | 2020-06-16 11:38:34 +0200 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-06-17 09:50:46 +0000 |
commit | 67bd4804ca771a5a1d6f2330c0c3573f149bfca1 (patch) | |
tree | 407d60572a7236706a619da2c6a67c9766f59a5c /common/onap-common-configuration-management | |
parent | 9db21cff33a8eadadb85071a37d2239f4ee6f068 (diff) |
Reduce nest statement levels
Reduce the if/for/switch/try nest statement levels to less than 3.
Issue-ID: SDC-3118
Signed-off-by: xuegao <xg353y@intl.att.com>
Change-Id: I490e66a807a0a8508b7e3c1da332546f2ced3005
Diffstat (limited to 'common/onap-common-configuration-management')
-rw-r--r-- | common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java | 21 |
1 files changed, 11 insertions, 10 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 491382ac5b..3fcbd4f1c4 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 @@ -84,18 +84,19 @@ public final class CliConfigurationImpl extends ConfigurationImpl implements Con private Object getInput(Map<String, Object> input) { Object toReturn = null; - if (input != null) { - try { - toReturn = Class.forName(input.get("ImplClass").toString()).newInstance(); - Method[] methods = toReturn.getClass().getMethods(); - for (Method method : methods) { - if (input.containsKey(method.getName())) { - method.invoke(toReturn, input.get(method.getName())); - } + if (input == null) { + return toReturn; + } + try { + toReturn = Class.forName(input.get("ImplClass").toString()).newInstance(); + Method[] methods = toReturn.getClass().getMethods(); + for (Method method : methods) { + if (input.containsKey(method.getName())) { + method.invoke(toReturn, input.get(method.getName())); } - } catch (Exception exception) { - LOGGER.warn("Error occurred while processing input: {}", input, exception); } + } catch (Exception exception) { + LOGGER.warn("Error occurred while processing input: {}", input, exception); } return toReturn; } |