Reduce nest statement levels 86/109186/2
authorxuegao <xg353y@intl.att.com>
Tue, 16 Jun 2020 09:38:34 +0000 (11:38 +0200)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Wed, 17 Jun 2020 09:50:46 +0000 (09:50 +0000)
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

common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java

index 491382a..3fcbd4f 100644 (file)
@@ -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;
     }