Merge "Replace deprecated methods in aai-common"
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / introspection / Introspector.java
index c9e1f45..87983d8 100644 (file)
@@ -103,9 +103,10 @@ public abstract class Introspector implements Cloneable {
         Class<?> clazz = this.getClass(name);
         if (this.isListType(name) && result == null) {
             try {
-                this.set(convertedName, clazz.newInstance());
+                this.set(convertedName, clazz.getDeclaredConstructor().newInstance());
                 result = this.get(convertedName);
-            } catch (DynamicException | InstantiationException | IllegalAccessException e) {
+            } catch (DynamicException | InstantiationException | IllegalAccessException | IllegalArgumentException
+                    | InvocationTargetException | NoSuchMethodException | SecurityException e) {
                 LOGGER.warn(e.getMessage(), e);
             }
         }
@@ -127,9 +128,10 @@ public abstract class Introspector implements Cloneable {
         Class<?> clazz = this.getClass(name);
         if (this.isListType(name) && value == null) {
             try {
-                this.set(convertedName, clazz.newInstance());
+                this.set(convertedName, clazz.getDeclaredConstructor().newInstance());
                 value = this.get(convertedName);
-            } catch (DynamicException | InstantiationException | IllegalAccessException e) {
+            } catch (DynamicException | InstantiationException | IllegalAccessException | IllegalArgumentException
+                    | InvocationTargetException | NoSuchMethodException | SecurityException e) {
                 LOGGER.warn(e.getMessage(), e);
             }
         }
@@ -159,9 +161,10 @@ public abstract class Introspector implements Cloneable {
         Class<?> clazz = this.getClass(name);
         if (isListType && value == null) {
             try {
-                this.set(convertedName, clazz.newInstance());
+                this.set(convertedName, clazz.getDeclaredConstructor().newInstance());
                 value = this.get(convertedName);
-            } catch (DynamicException | InstantiationException | IllegalAccessException e) {
+            } catch (DynamicException | InstantiationException | IllegalAccessException | IllegalArgumentException
+                    | InvocationTargetException | NoSuchMethodException | SecurityException e) {
                 LOGGER.warn(e.getMessage(), e);
             }
         }