From e98fe40ba47af72eb26d11722d3bba16da374cc8 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Mon, 19 Aug 2024 16:17:03 +0200 Subject: Update spring-boot to 2.5 in aai-common - update spring-boot (2.4 -> 2.5.15) - update vulnerable dependencies (spring-jms) - remove old codehaus.jackson dependency Issue-ID: AAI-3972 Change-Id: Ie0854c192a3a7bb719e9ac0e080e83a48e1b964a Signed-off-by: Fiete Ostkamp --- .../aai/aaf/filters/AafAuthorizationFilter.java | 2 -- .../aaf/filters/AafCertAuthorizationFilter.java | 2 -- .../org/onap/aai/aaf/filters/AafCertFilter.java | 2 -- .../java/org/onap/aai/aaf/filters/AafFilter.java | 2 -- .../java/org/onap/aai/aaf/filters/CadiProps.java | 2 -- .../org/onap/aai/aaf/filters/GremlinFilter.java | 2 -- aai-core/pom.xml | 9 +------- .../src/main/java/org/onap/aai/util/PojoUtils.java | 8 +++++-- .../test/java/org/onap/aai/util/PojoUtilsTest.java | 12 +---------- aai-parent/pom.xml | 25 +++++----------------- aai-schema-abstraction/pom.xml | 8 ------- .../onap/aai/schemaif/oxm/RelationshipSchema.java | 2 +- 12 files changed, 14 insertions(+), 62 deletions(-) diff --git a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafAuthorizationFilter.java b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafAuthorizationFilter.java index 485fa7e3..fb7a58e6 100644 --- a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafAuthorizationFilter.java +++ b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafAuthorizationFilter.java @@ -32,7 +32,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.aai.aaf.auth.ResponseFormatter; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; @@ -59,7 +58,6 @@ public class AafAuthorizationFilter extends OrderedRequestContextFilter { private List advancedKeywordsList; - @Autowired public AafAuthorizationFilter(GremlinFilter gremlinFilter, @Value("${permission.type}") String type, @Value("${permission.instance}") String instance, @Value("${advanced.keywords.list:}") String advancedKeys) { diff --git a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertAuthorizationFilter.java b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertAuthorizationFilter.java index 56799f1c..f19f4b8e 100644 --- a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertAuthorizationFilter.java +++ b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertAuthorizationFilter.java @@ -32,7 +32,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.aai.aaf.auth.AafRequestFilter; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; @@ -60,7 +59,6 @@ public class AafCertAuthorizationFilter extends OrderedRequestContextFilter { private List advancedKeywordsList; - @Autowired public AafCertAuthorizationFilter(@Value("${permission.type}") String type, @Value("${permission.instance}") String instance, @Value("${advanced.keywords.list:}") String advancedKeys, CadiProps cadiProps) { diff --git a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertFilter.java b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertFilter.java index e423dc0a..a3ce12b0 100644 --- a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertFilter.java +++ b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertFilter.java @@ -32,7 +32,6 @@ import org.onap.aaf.cadi.filter.CadiFilter; import org.onap.aai.aaf.auth.AafRequestFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; @@ -57,7 +56,6 @@ public class AafCertFilter extends OrderedRequestContextFilter { private final CadiProps cadiProps; - @Autowired public AafCertFilter(@Value("${aaf.userchain.pattern}") String aafUserChainPattern, CadiProps cadiProps) throws IOException, ServletException { diff --git a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafFilter.java b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafFilter.java index 5dbc2e7a..ae3a6ca6 100644 --- a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafFilter.java +++ b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafFilter.java @@ -32,7 +32,6 @@ import org.onap.aaf.cadi.filter.CadiFilter; import org.onap.aai.aaf.auth.ResponseFormatter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @@ -49,7 +48,6 @@ public class AafFilter extends OrderedRequestContextFilter { private final CadiFilter cadiFilter; - @Autowired public AafFilter(CadiProps cadiProps) throws IOException, ServletException { cadiFilter = new CadiFilter(new PropAccess((level, element) -> { switch (level) { diff --git a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/CadiProps.java b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/CadiProps.java index 4bf9ea82..01b89148 100644 --- a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/CadiProps.java +++ b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/CadiProps.java @@ -30,7 +30,6 @@ import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @@ -46,7 +45,6 @@ public class CadiProps { private Properties cadiProperties; - @Autowired public CadiProps(@Value("${aaf.cadi.file:./resources/cadi.properties}") String filename) { cadiFileName = filename; cadiProperties = new Properties(); diff --git a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/GremlinFilter.java b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/GremlinFilter.java index dffa74ef..f800097f 100644 --- a/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/GremlinFilter.java +++ b/aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/GremlinFilter.java @@ -33,7 +33,6 @@ import org.apache.commons.io.IOUtils; import org.onap.aai.aaf.auth.ResponseFormatter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @@ -54,7 +53,6 @@ public class GremlinFilter { private CadiProps cadiProps; - @Autowired public GremlinFilter(@Value("${permission.type}") String type, @Value("${permission.instance}") String instance, CadiProps cadiProps) { this.type = type; diff --git a/aai-core/pom.xml b/aai-core/pom.xml index 8e0d23b1..d2aed3a0 100644 --- a/aai-core/pom.xml +++ b/aai-core/pom.xml @@ -151,14 +151,6 @@ limitations under the License. eelf-core 2.0.0-oss - - org.codehaus.jackson - jackson-core-asl - - - org.codehaus.jackson - jackson-mapper-asl - junit junit @@ -272,6 +264,7 @@ limitations under the License. org.apache.tinkerpop gremlin-core + ${gremlin.version} org.apache.tinkerpop 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 f974ba14..4c2ce942 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 @@ -27,6 +27,7 @@ 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.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; import com.google.common.base.CaseFormat; import com.google.common.collect.Multimap; @@ -124,12 +125,15 @@ public class PojoUtils { */ public String getJsonFromObject(T clazz, boolean wrapRoot, boolean indent) throws JsonGenerationException, JsonMappingException, IOException { - ObjectMapper mapper = JsonMapper.builder().serializationInclusion(JsonInclude.Include.NON_NULL) + ObjectMapper mapper = JsonMapper.builder() + .addModule(new JaxbAnnotationModule()) + .addModule(new JavaTimeModule()) + .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()) + .configure(DeserializationFeature.UNWRAP_ROOT_VALUE, wrapRoot) .build(); return mapper.writeValueAsString(clazz); diff --git a/aai-core/src/test/java/org/onap/aai/util/PojoUtilsTest.java b/aai-core/src/test/java/org/onap/aai/util/PojoUtilsTest.java index 68f01962..a6a8c33d 100644 --- a/aai-core/src/test/java/org/onap/aai/util/PojoUtilsTest.java +++ b/aai-core/src/test/java/org/onap/aai/util/PojoUtilsTest.java @@ -100,18 +100,8 @@ public class PojoUtilsTest { LocalDateTime date = LocalDateTime.of(2017, Month.SEPTEMBER, 18, 10, 55, 0, 300); String res = pojoUtils.getJsonFromObject(date); - + assertEquals("\"2017-09-18T10:55:00.0000003\"", res); assertNotNull(res); - assertTrue(res.contains("\"dayOfMonth\" : 18")); - assertTrue(res.contains("\"dayOfWeek\" : \"MONDAY\"")); - assertTrue(res.contains("\"dayOfYear\" : 261")); - assertTrue(res.contains("\"hour\" : 10")); - assertTrue(res.contains("\"minute\" : 55")); - assertTrue(res.contains("\"month\" : \"SEPTEMBER\"")); - assertTrue(res.contains("\"monthValue\" : 9")); - assertTrue(res.contains("\"nano\" : 300")); - assertTrue(res.contains("\"second\" : 0")); - assertTrue(res.contains("\"year\" : 2017")); } @Test diff --git a/aai-parent/pom.xml b/aai-parent/pom.xml index b13fb601..717049eb 100644 --- a/aai-parent/pom.xml +++ b/aai-parent/pom.xml @@ -47,7 +47,6 @@ limitations under the License. 2.1.15 4.11.1 5.16.1 - 1.9.13 1.9.4 1.5.0 1.21 @@ -68,7 +67,6 @@ limitations under the License. 2.9.1 2.0.0.0 2.2 - 2.11.4 1.2 2.3.1 2.3.0.1 @@ -91,8 +89,8 @@ limitations under the License. Please don't upgrade to 2.3.0 or above for nexus iq or security scans as it could potentially break our code --> - 2.4.13 - 5.3.13 + 2.5.15 + 5.3.39 5.2.25.RELEASE ${spring.version} 2.2.0 @@ -138,13 +136,6 @@ limitations under the License. - - com.fasterxml.jackson - jackson-bom - ${jackson.bom.version} - pom - import - org.springframework.boot spring-boot-dependencies @@ -175,7 +166,7 @@ limitations under the License. org.springframework spring-jms - 5.3.31 + 5.3.39 @@ -504,12 +495,6 @@ limitations under the License. ${commons.text.version} - - org.codehaus.jackson - jackson-core-asl - ${codehaus.jackson.version} - - com.sun.jersey jersey-core @@ -803,7 +788,7 @@ limitations under the License. org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.1.2 ${surefireArgLine} @@ -816,7 +801,7 @@ limitations under the License. org.apache.maven.plugins maven-failsafe-plugin - 3.0.0-M4 + 3.1.2 diff --git a/aai-schema-abstraction/pom.xml b/aai-schema-abstraction/pom.xml index 00442e42..c89cf6eb 100644 --- a/aai-schema-abstraction/pom.xml +++ b/aai-schema-abstraction/pom.xml @@ -85,14 +85,6 @@ ch.qos.logback logback-access - - org.codehaus.jackson - jackson-core-asl - - - org.codehaus.jackson - jackson-mapper-asl - com.fasterxml.jackson.core jackson-databind diff --git a/aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/RelationshipSchema.java b/aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/RelationshipSchema.java index 921cff33..32350779 100644 --- a/aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/RelationshipSchema.java +++ b/aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/RelationshipSchema.java @@ -23,6 +23,7 @@ package org.onap.aai.schemaif.oxm; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Multimap; import java.io.IOException; @@ -35,7 +36,6 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import org.codehaus.jackson.map.ObjectMapper; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.aai.edges.EdgeRule; import org.onap.aai.schemaif.SchemaProviderException; -- cgit 1.2.3-korg