From ad0a27dd628ba9f76d250747e35d262e7eb7b26f Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Tue, 18 Oct 2022 12:13:29 +0000 Subject: Update aai-common dependencies Issue-ID: AAI-3553 Signed-off-by: Fiete Ostkamp Change-Id: I2b79669b922a43d30b7d412bfd86f1506f6b4f6f --- .../src/main/java/org/onap/aai/util/PojoUtils.java | 84 +++++++++++----------- aai-parent/pom.xml | 37 +++++----- 2 files changed, 60 insertions(+), 61 deletions(-) diff --git a/aai-core/src/main/java/org/onap/aai/util/PojoUtils.java b/aai-core/src/main/java/org/onap/aai/util/PojoUtils.java index 83dc4698..d83c9ec3 100644 --- a/aai-core/src/main/java/org/onap/aai/util/PojoUtils.java +++ b/aai-core/src/main/java/org/onap/aai/util/PojoUtils.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.nio.charset.Charset; import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collection; @@ -50,6 +51,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; import com.google.common.base.CaseFormat; import com.google.common.collect.Multimap; @@ -59,12 +61,12 @@ public class PojoUtils { /** * Gets the key value list. * - * @param the generic type - * @param e the e + * @param the generic type + * @param e the e * @param clazz the clazz * @return the key value list - * @throws IllegalAccessException the illegal access exception - * @throws IllegalArgumentException the illegal argument exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception * @throws InvocationTargetException the invocation target exception */ public List getKeyValueList(Entity e, T clazz) @@ -97,12 +99,12 @@ public class PojoUtils { /** * Gets the json from object. * - * @param the generic type + * @param the generic type * @param clazz the clazz * @return the json from object * @throws JsonGenerationException the json generation exception - * @throws JsonMappingException the json mapping exception - * @throws IOException Signals that an I/O exception has occurred. + * @throws JsonMappingException the json mapping exception + * @throws IOException Signals that an I/O exception has occurred. */ public String getJsonFromObject(T clazz) throws JsonGenerationException, JsonMappingException, IOException { return getJsonFromObject(clazz, false, true); @@ -111,29 +113,26 @@ public class PojoUtils { /** * Gets the json from object. * - * @param the generic type - * @param clazz the clazz + * @param the generic type + * @param clazz the clazz * @param wrapRoot the wrap root - * @param indent the indent + * @param indent the indent * @return the json from object * @throws JsonGenerationException the json generation exception - * @throws JsonMappingException the json mapping exception - * @throws IOException Signals that an I/O exception has occurred. + * @throws JsonMappingException the json mapping exception + * @throws IOException Signals that an I/O exception has occurred. */ public String getJsonFromObject(T clazz, boolean wrapRoot, boolean indent) throws JsonGenerationException, JsonMappingException, IOException { - ObjectMapper mapper = new ObjectMapper(); - - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - - mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); - mapper.configure(SerializationFeature.INDENT_OUTPUT, indent); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, wrapRoot); - - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, wrapRoot); - - mapper.registerModule(new JaxbAnnotationModule()); + ObjectMapper mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) + .configure(SerializationFeature.INDENT_OUTPUT, indent) + .configure(SerializationFeature.WRAP_ROOT_VALUE, wrapRoot) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .configure(DeserializationFeature.UNWRAP_ROOT_VALUE, wrapRoot) + .addModule(new JaxbAnnotationModule()) + .build(); return mapper.writeValueAsString(clazz); } @@ -141,14 +140,14 @@ public class PojoUtils { /** * Gets the json from dynamic object. * - * @param ent the ent + * @param ent the ent * @param jaxbContext the jaxb context * @param includeRoot the include root * @return the json from dynamic object * @throws JsonGenerationException the json generation exception - * @throws JsonMappingException the json mapping exception - * @throws IOException Signals that an I/O exception has occurred. - * @throws JAXBException the JAXB exception + * @throws JsonMappingException the json mapping exception + * @throws IOException Signals that an I/O exception has occurred. + * @throws JAXBException the JAXB exception */ public String getJsonFromDynamicObject(DynamicEntity ent, org.eclipse.persistence.jaxb.JAXBContext jaxbContext, boolean includeRoot) throws JsonGenerationException, JsonMappingException, IOException, JAXBException { @@ -167,7 +166,7 @@ public class PojoUtils { /** * Gets the xml from object. * - * @param the generic type + * @param the generic type * @param clazz the clazz * @return the xml from object * @throws JAXBException the JAXB exception @@ -180,16 +179,17 @@ public class PojoUtils { Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(clazz, baos); - return baos.toString(); + + return baos.toString(Charset.defaultCharset()); } } /** * Gets the lookup key. * - * @param baseKey the base key + * @param baseKey the base key * @param lookupHash the lookup hash - * @param keyProps the key props + * @param keyProps the key props * @return the lookup key */ public String getLookupKey(String baseKey, HashMap lookupHash, Collection keyProps) { @@ -213,7 +213,7 @@ public class PojoUtils { /** * Gets the lookup keys. * - * @param lookupHashes the lookup hashes + * @param lookupHashes the lookup hashes * @param _dbRulesNodeKeyProps the db rules node key props * @return the lookup keys */ @@ -237,16 +237,16 @@ public class PojoUtils { /** * Gets the example object. * - * @param the generic type - * @param clazz the clazz + * @param the generic type + * @param clazz the clazz * @param singleton the singleton * @return the example object - * @throws IllegalAccessException the illegal access exception - * @throws IllegalArgumentException the illegal argument exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception * @throws InvocationTargetException the invocation target exception - * @throws NoSuchMethodException the no such method exception - * @throws SecurityException the security exception - * @throws AAIException the AAI exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws AAIException the AAI exception */ public void getExampleObject(T clazz, boolean singleton) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, @@ -304,8 +304,8 @@ public class PojoUtils { * Gets the dynamic example object. * * @param childObject the child object - * @param aaiRes the aai res - * @param singleton the singleton + * @param aaiRes the aai res + * @param singleton the singleton * @return the dynamic example object */ public void getDynamicExampleObject(DynamicEntity childObject, AAIResource aaiRes, boolean singleton) { diff --git a/aai-parent/pom.xml b/aai-parent/pom.xml index c19a1e06..ed402912 100644 --- a/aai-parent/pom.xml +++ b/aai-parent/pom.xml @@ -40,47 +40,46 @@ limitations under the License. ${aai.common.version} - 1.5.1 - 1.5.1 - 1.7.3 + 1.8.0 + 1.6.4 + 1.9.6 2.1.15 - 4.7.2 + 4.11.1 5.16.1 1.9.13 1.9.4 - 1.4 + 1.5.0 1.21 1.10 - 2.8.0 - 2.6 + 2.11.0 3.9 - 3.6 - 1.8 - 0.31.0 - 1.1.9 - 4.0.2 + 3.8.0 + 1.10.0 + 0.40.2 + 1.1.12 + 5.0.0 2.7.11 2.0.0-oss 2.3.31 - 19.0 + 31.1-jre 3.2.3 2.5.15 - 2.8.6 + 2.9.1 2.0.0.0 2.2 - 2.10.1 + 2.11.4 0.2.3 1.2 2.3.1 2.3.0.1 - 2.0.1 + 2.1.1 1.78 1.19.4 - 2.1.11 - 0.0.24 + 2.2.12 + 0.1.7 5.0.4 - 1.5.0 + 1.5.1 1.9