diff options
Diffstat (limited to 'aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java')
-rw-r--r-- | aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java b/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java index 40352360..2676d19d 100644 --- a/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java +++ b/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java @@ -21,6 +21,7 @@ package org.onap.aai.introspection; import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; import java.util.List; import java.util.Map; import java.util.Set; @@ -159,8 +160,9 @@ public class JSONStrategy extends Introspector { @Override public Object newInstanceOfProperty(String name) { try { - return this.getClass(name).newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + return this.getClass(name).getDeclaredConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException + | NoSuchMethodException | SecurityException e) { return null; } } @@ -168,8 +170,9 @@ public class JSONStrategy extends Introspector { @Override public Object newInstanceOfNestedProperty(String name) { try { - return this.getGenericTypeClass(name).newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + return this.getGenericTypeClass(name).getDeclaredConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException + | NoSuchMethodException | SecurityException e) { return null; } } |