Code Inspection WHOLE project 72/141972/1
authorToineSiebelink <toine.siebelink@est.tech>
Tue, 2 Sep 2025 15:55:15 +0000 (16:55 +0100)
committerToineSiebelink <toine.siebelink@est.tech>
Tue, 2 Sep 2025 17:06:24 +0000 (18:06 +0100)
- applied most of the simple/safe stuff
- Many @suppress unchecked-warnings
- Many @Serial annotations
- A lot of copyrights updates!

Issue-ID: CPS-2941
Change-Id: Id926ba1e9d7c6e0941355f89e5c736907e7af165
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
54 files changed:
cps-application/src/main/java/org/onap/cps/Application.java
cps-application/src/main/java/org/onap/cps/startup/InstanceStartupDelayManager.java
cps-ncmp-events/src/main/java/org/onap/cps/ncmp/events/NcmpEventDataSchema.java
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/CountCmHandleSearchExecution.java
cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/PathParsingException.java
cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java
cps-rest/src/main/java/org/onap/cps/rest/utils/MultipartFileUtil.java
cps-rest/src/main/java/org/onap/cps/rest/utils/ZipFileSizeValidator.java
cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy
cps-rest/src/test/groovy/org/onap/cps/rest/utils/ZipFileSizeValidatorSpec.groovy
cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java
cps-ri/src/main/java/org/onap/cps/ri/models/AnchorEntity.java
cps-ri/src/main/java/org/onap/cps/ri/models/DataspaceEntity.java
cps-ri/src/main/java/org/onap/cps/ri/models/FragmentEntity.java
cps-ri/src/main/java/org/onap/cps/ri/models/SchemaSetEntity.java
cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceEntity.java
cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentQueryBuilder.java
cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQuery.java
cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java
cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java
cps-ri/src/main/java/org/onap/cps/ri/utils/SessionManager.java
cps-service/src/main/java/org/onap/cps/api/exceptions/AlreadyDefinedException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/AnchorNotFoundException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/CpsAdminException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/CpsException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/CpsPathException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/DataInUseException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/DataNodeNotFoundException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/DataValidationException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/DataspaceInUseException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/DataspaceNotFoundException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/DuplicatedYangResourceException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/ModelValidationException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/ModuleNamesNotFoundException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/NotFoundInDataspaceException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/SchemaSetInUseException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/SchemaSetNotFoundException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/SessionManagerException.java
cps-service/src/main/java/org/onap/cps/api/exceptions/SessionTimeoutException.java
cps-service/src/main/java/org/onap/cps/api/model/Anchor.java
cps-service/src/main/java/org/onap/cps/api/model/DataNode.java
cps-service/src/main/java/org/onap/cps/api/model/Dataspace.java
cps-service/src/main/java/org/onap/cps/api/model/ModuleDefinition.java
cps-service/src/main/java/org/onap/cps/api/model/ModuleReference.java
cps-service/src/main/java/org/onap/cps/api/model/SchemaSet.java
cps-service/src/main/java/org/onap/cps/events/EventsProducer.java
cps-service/src/main/java/org/onap/cps/impl/DataNodeBuilder.java
cps-service/src/main/java/org/onap/cps/impl/YangTextSchemaSourceSetCache.java
cps-service/src/main/java/org/onap/cps/utils/XmlFileUtils.java
cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java
cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java
cps-service/src/test/groovy/org/onap/cps/impl/DataNodeBuilderSpec.groovy
policy-executor-stub/src/main/java/org/onap/cps/policyexecutor/stub/controller/PolicyExecutorStubController.java

index 3c7750d..7e06907 100644 (file)
@@ -29,7 +29,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 @Slf4j\r
 public class Application {\r
 \r
-    static InstanceStartupDelayManager instanceStartupDelayManager = new InstanceStartupDelayManager();\r
+    static final InstanceStartupDelayManager instanceStartupDelayManager = new InstanceStartupDelayManager();\r
 \r
     /**\r
      * The main method which serves as the entry point to the Spring Boot application.\r
index 4ce9422..213fb34 100644 (file)
@@ -47,7 +47,7 @@ public class InstanceStartupDelayManager {
             final Matcher matcher = HOST_NAME_WITH_SEQUENCE_PATTERN.matcher(hostName);
             final long startupDelayInMillis;
             if (matcher.matches()) {
-                startupDelayInMillis = Integer.valueOf(matcher.group(1)) * 2_000L;
+                startupDelayInMillis = Integer.parseInt(matcher.group(1)) * 2_000L;
                 log.info("Sequenced host name detected, calculated delay = {} ms", startupDelayInMillis);
             } else {
                 startupDelayInMillis = Math.abs(hostName.hashCode() % 10_000L);
index 9cdb6d7..2a31179 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2025 Nordix Foundation
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -27,9 +27,7 @@ public enum NcmpEventDataSchema {
 
     BATCH_RESPONSE_V1("urn:cps:org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent:1.0.0"),
     SUBSCRIPTIONS_V1("urn:cps:org.onap.ncmp.events.subscription:1.0.0"),
-    MOI_CHANGES_V1("urn:cps:org.onap.cps.ncmp.events.moi-changes:1.0.0"),
-    INVENTORY_EVENTS_V1("urn:cps:org.onap.cps.ncmp.events:inventory-event:1.0.0"),
-    CM_HANDLE_TRUST_LEVEL_V1("urn:cps:org.onap.cps.ncmp.dmi.events:cm-handle-trust-level:1.0.0");
+    INVENTORY_EVENTS_V1("urn:cps:org.onap.cps.ncmp.events:inventory-event:1.0.0");
 
     private final String dataSchema;
 
index c0744e9..3fbf051 100644 (file)
@@ -125,6 +125,7 @@ public class NetworkCmProxyInventoryController implements NetworkCmProxyInventor
      *
      * @param restDmiPluginRegistration the registration data
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     @Override
     @Timed(value = "cps.ncmp.inventory.controller.update",
         description = "Time taken to handle registration request")
index d04a2ea..e876068 100644 (file)
@@ -48,5 +48,6 @@ public @interface CountCmHandleSearchExecution {
      *
      * @return the description of the metric.
      */
+    @SuppressWarnings("UnusedReturnValue")
     String description();
 }
index 4a67167..ef3f8d2 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation
+ *  Copyright (C) 2022-2025 OpenInfra Foundation Europe.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 
 package org.onap.cps.cpspath.parser;
 
+import java.io.Serial;
 import lombok.Getter;
 
 /**
@@ -27,6 +28,7 @@ import lombok.Getter;
  */
 public class PathParsingException extends RuntimeException {
 
+    @Serial
     private static final long serialVersionUID = 7072864354925271894L;
 
     @Getter
index 01a9746..f1215ba 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2020-2025 Nordix Foundation
+ *  Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
  *  Modifications Copyright (C) 2020-2021 Bell Canada.
  *  Modifications Copyright (C) 2021 Pantheon.tech
  *  Modifications Copyright (C) 2022-2025 TechMahindra Ltd.
@@ -68,7 +68,7 @@ public class AdminRestController implements CpsAdminApi {
      * Create a dataspace.
      *
      * @param dataspaceName dataspace name
-     * @return a {@Link ResponseEntity} of created dataspace name & {@link HttpStatus} CREATED
+     * @return a { {@code @Link}  ResponseEntity }  of created dataspace name & {@link HttpStatus} CREATED
      */
     @Override
     public ResponseEntity<String> createDataspace(@NotNull @Valid final String dataspaceName) {
@@ -80,7 +80,7 @@ public class AdminRestController implements CpsAdminApi {
      * Create a dataspace without returning any response body.
      *
      * @param dataspaceName dataspace name
-     * @return a {@Link ResponseEntity} of created dataspace name & {@link HttpStatus} CREATED
+     * @return a { {@code @Link}  ResponseEntity }  of created dataspace name & {@link HttpStatus} CREATED
      */
     @Override
     public ResponseEntity<Void> createDataspaceV2(@NotNull @Valid final String dataspaceName) {
@@ -92,7 +92,7 @@ public class AdminRestController implements CpsAdminApi {
      * Delete a dataspace.
      *
      * @param dataspaceName name of dataspace to be deleted
-     * @return a {@Link ResponseEntity} of {@link HttpStatus} NO_CONTENT
+     * @return a { {@code @Link}  ResponseEntity }  of {@link HttpStatus} NO_CONTENT
      */
     @Override
     public ResponseEntity<Void> deleteDataspace(final String apiVersion, final String dataspaceName) {
@@ -106,7 +106,7 @@ public class AdminRestController implements CpsAdminApi {
      * @param dataspaceName dataspace name
      * @param schemaSetName schemaset name
      * @param multipartFile multipart file
-     * @return a {@Link ResponseEntity} of created schemaset name & {@link HttpStatus} CREATED
+     * @return a { {@code @Link}  ResponseEntity }  of created schemaset name & {@link HttpStatus} CREATED
      */
     @Override
     public ResponseEntity<String> createSchemaSet(final String dataspaceName,
@@ -122,7 +122,8 @@ public class AdminRestController implements CpsAdminApi {
      * @param dataspaceName dataspace name
      * @param schemaSetName schemaset name
      * @param multipartFile multipart file
-     * @return a {@Link ResponseEntity} of created schema set without any response body & {@link HttpStatus} CREATED
+     * @return a { {@code @Link}  ResponseEntity } of created schema set
+     *         without any response body & {@link HttpStatus} CREATED
      */
     @Override
     @Timed(value = "cps.rest.admin.controller.schemaset.create",
@@ -140,7 +141,7 @@ public class AdminRestController implements CpsAdminApi {
      * @param apiVersion api version
      * @param dataspaceName dataspace name
      * @param schemaSetName schemaset name
-     * @return a {@Link ResponseEntity} of {@Link SchemaSetDetails} & {@link HttpStatus} OK
+     * @return a { {@code @Link}  ResponseEntity }  of { {@code @Link}  SchemaSetDetails }  & {@link HttpStatus} OK
      */
     @Override
     public ResponseEntity<SchemaSetDetails> getSchemaSet(final String apiVersion,
@@ -155,7 +156,7 @@ public class AdminRestController implements CpsAdminApi {
      *
      * @param apiVersion api version
      * @param dataspaceName dataspace name
-     * @return a {@Link ResponseEntity} of schema sets & {@link HttpStatus} OK
+     * @return a { {@code @Link}  ResponseEntity }  of schema sets & {@link HttpStatus} OK
      */
     @Override
     public ResponseEntity<List<SchemaSetDetails>> getSchemaSets(final String apiVersion, final String dataspaceName) {
@@ -171,7 +172,7 @@ public class AdminRestController implements CpsAdminApi {
      * @param apiVersion api version
      * @param dataspaceName dataspace name
      * @param schemaSetName schemaset name
-     * @return a {@Link ResponseEntity} of {@link HttpStatus} NO_CONTENT
+     * @return a { {@code @Link}  ResponseEntity }  of {@link HttpStatus} NO_CONTENT
      */
     @Override
     public ResponseEntity<Void> deleteSchemaSet(final String apiVersion,
@@ -186,7 +187,7 @@ public class AdminRestController implements CpsAdminApi {
      * @param apiVersion api version
      * @param dataspaceName dataspace name
      *
-     * @return a {@Link ResponseEntity} of {@link HttpStatus} NO_CONTENT
+     * @return a { {@code @Link}  ResponseEntity }  of {@link HttpStatus} NO_CONTENT
      */
     @Override
     public ResponseEntity<Void> cleanDataspace(final String apiVersion, final String dataspaceName) {
@@ -230,7 +231,7 @@ public class AdminRestController implements CpsAdminApi {
      * @param apiVersion api version
      * @param dataspaceName dataspace name
      * @param anchorName anchor name
-     * @return a {@Link ResponseEntity} of {@link HttpStatus} NO_CONTENT
+     * @return a { {@code @Link}  ResponseEntity }  of {@link HttpStatus} NO_CONTENT
      */
     @Override
     public ResponseEntity<Void> deleteAnchor(final String apiVersion,
@@ -245,7 +246,7 @@ public class AdminRestController implements CpsAdminApi {
      * @param apiVersion api version
      * @param dataspaceName dataspace name
      * @param anchorName anchor name
-     * @return a {@Link ResponseEntity} of an {@Link AnchorDetails} & {@link HttpStatus} OK
+     * @return a { {@code @Link}  ResponseEntity }  of an { {@code @Link}  AnchorDetails }  & {@link HttpStatus} OK
      */
     @Override
     public ResponseEntity<AnchorDetails> getAnchor(final String apiVersion,
@@ -260,7 +261,7 @@ public class AdminRestController implements CpsAdminApi {
      *
      * @param apiVersion api version
      * @param dataspaceName dataspace name
-     * @return a {@Link ResponseEntity} of all {@Link AnchorDetails} & {@link HttpStatus} OK
+     * @return a { {@code @Link}  ResponseEntity }  of all { {@code @Link}  AnchorDetails }  & {@link HttpStatus} OK
      */
     @Override
     public ResponseEntity<List<AnchorDetails>> getAnchors(final String apiVersion,
index b41d78b..3c1cc5d 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
  *  Modifications Copyright (C) 2021 Bell Canada.
- *  Modifications Copyright (C) 2023 Nordix Foundation.
+ *  Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
  *  Modifications Copyright (C) 2025 TechMahindra Ltd.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -77,7 +77,7 @@ public class MultipartFileUtil {
      *
      * @param multipartFile the json file uploaded
      * @return the string representation of the JSON content
-     * @throws IOException if the file is null or empty
+     * @throws DataValidationException if the file is null or empty
      */
 
     public static String extractJsonContent(final MultipartFile multipartFile, final JsonObjectMapper
@@ -165,7 +165,7 @@ public class MultipartFileUtil {
                 byteArrayOutputStream.write(buffer, 0, numberOfBytesRead);
                 totalSizeEntry += numberOfBytesRead;
                 zipFileSizeValidator.updateTotalUncompressedSizeOfYangFilesInArchive(numberOfBytesRead);
-                zipFileSizeValidator.validateCompresssionRatio(totalSizeEntry);
+                zipFileSizeValidator.validateCompressionRatio(totalSizeEntry);
             }
             return byteArrayOutputStream.toString(StandardCharsets.UTF_8);
         }
index 0308a10..316b4d4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Bell Canada.
- *  Modifications Copyright (C) 2023 Nordix Foundation.
+ *  Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -29,7 +29,8 @@ import org.onap.cps.api.exceptions.ModelValidationException;
 public class ZipFileSizeValidator {
 
     private static final int THRESHOLD_ENTRIES = 10000;
-    private static int thresholdSize = 100000000;
+    @SuppressWarnings("FieldCanBeLocal")
+    private static int THRESHOLD_SIZE = 100000000;
     private static final double THRESHOLD_RATIO = 40;
     private static final String INVALID_ZIP = "Invalid ZIP archive content.";
 
@@ -58,7 +59,7 @@ public class ZipFileSizeValidator {
      *
      * @param totalEntrySize the size of the unzipped entry.
      */
-    public void validateCompresssionRatio(final int totalEntrySize) {
+    public void validateCompressionRatio(final int totalEntrySize) {
         final double compressionRatio = (double) totalEntrySize / compressedSize;
         if (compressionRatio > THRESHOLD_RATIO) {
             throw new ModelValidationException(INVALID_ZIP,
@@ -71,10 +72,10 @@ public class ZipFileSizeValidator {
      * Validate the total Size and number of entries in the zip.
      */
     public void validateSizeAndEntries() {
-        if (totalUncompressedSizeOfYangFilesInArchive > thresholdSize) {
+        if (totalUncompressedSizeOfYangFilesInArchive > THRESHOLD_SIZE) {
             throw new ModelValidationException(INVALID_ZIP,
                 String.format("The total size of uncompressed yang files exceeds the CPS limit of %s bytes.",
-                        thresholdSize));
+                    THRESHOLD_SIZE));
         }
         if (totalYangFileEntriesInArchive > THRESHOLD_ENTRIES) {
             throw new ModelValidationException(INVALID_ZIP,
index 73819f8..97c0ff1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
- *  Modifications Copyright (C) 2023 Nordix Foundation.
+ *  Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ class MultipartFileUtilSpec extends Specification {
 
     def 'Yang file limits in zip archive: #scenario for the bug reported in CPS-1477'() {
         given: 'a yang file size (uncompressed) limit of #threshold bytes'
-            ZipFileSizeValidator.thresholdSize = threshold
+            ZipFileSizeValidator.THRESHOLD_SIZE = threshold
         and: 'an archive with a yang file of 1083 bytes'
             def multipartFile = multipartZipFileFromResource('/yang-files-set-total-1083-bytes.zip')
         when: 'attempt to extract yang files'
index e5aecb9..cdb206a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Bell Canada.
- *  Modifications Copyright (C) 2023 Nordix Foundation.
+ *  Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import spock.lang.Specification
 
 class ZipFileSizeValidatorSpec extends Specification {
 
-    def static thresholdSize = ZipFileSizeValidator.thresholdSize
+    def static thresholdSize = ZipFileSizeValidator.THRESHOLD_SIZE
     def static thresholdEntries = ZipFileSizeValidator.THRESHOLD_ENTRIES
     def static thresholdRatio = ZipFileSizeValidator.THRESHOLD_RATIO
 
@@ -58,7 +58,7 @@ class ZipFileSizeValidatorSpec extends Specification {
         given: 'the totalEntrySize of the archive so that compression ratio is within the threshold'
             int totalEntrySize = compressedFileSize * thresholdRatio - 1
         when: 'the validation is performed against the threshold compression ratio'
-            objectUnderTest.validateCompresssionRatio(totalEntrySize)
+            objectUnderTest.validateCompressionRatio(totalEntrySize)
         then: 'validation passes and no exception is thrown'
             noExceptionThrown()
     }
@@ -67,7 +67,7 @@ class ZipFileSizeValidatorSpec extends Specification {
         given: 'the totalEntrySize of the archive so that compression ratio is higher than the threshold'
             int totalEntrySize = compressedFileSize * thresholdRatio + 1
         when: 'the validation is performed against the threshold compression ratio'
-            objectUnderTest.validateCompresssionRatio(totalEntrySize)
+            objectUnderTest.validateCompressionRatio(totalEntrySize)
         then: 'validation fails and exception is thrown'
             thrown ModelValidationException
     }
index 472da34..ddf7d6e 100644 (file)
@@ -249,7 +249,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
         }
         final AnchorEntity anchorEntity = getAnchorEntity(dataspaceName, anchorName);
         return fragmentRepository.findAttributeValuesByAnchorAndCpsPath(anchorEntity, cpsPathQuery,
-                cpsPathQuery.getAttributeAxisAttributeName(), queryResultLimit, targetClass);
+            queryResultLimit, targetClass);
     }
 
     @Override
@@ -511,6 +511,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
         return Collections.unmodifiableList(dataNodes);
     }
 
+    @SuppressWarnings("unchecked")
     private DataNode toDataNode(final FragmentEntity fragmentEntity,
                                 final FetchDescendantsOption fetchDescendantsOption) {
         final List<DataNode> childDataNodes = getChildDataNodes(fragmentEntity, fetchDescendantsOption);
@@ -596,6 +597,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
         return existingListElementEntity;
     }
 
+    @SuppressWarnings("unchecked")
     private String mergeLeaves(final Map<String, Serializable> updateLeaves, final String currentLeavesAsString) {
         Map<String, Serializable> currentLeavesAsMap = new HashMap<>();
         if (currentLeavesAsString != null) {
@@ -628,6 +630,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
         if (currentLeavesAsString == null) {
             return "{}";
         }
+        @SuppressWarnings("unchecked")
         final Map<String, Serializable> sortedLeaves = jsonObjectMapper.convertJsonString(currentLeavesAsString,
             TreeMap.class);
         return jsonObjectMapper.asJsonString(sortedLeaves);
index bf9e25d..6c67006 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Pantheon.tech
- *  Modifications Copyright (C) 2023 Nordix Foundation.
+ *  Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@ import jakarta.persistence.JoinColumn;
 import jakarta.persistence.ManyToOne;
 import jakarta.persistence.Table;
 import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
 import java.io.Serializable;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -52,6 +53,7 @@ import lombok.Setter;
 @EqualsAndHashCode(onlyExplicitlyIncluded = true)
 public class AnchorEntity implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = -8049987915308262518L;
 
     @Id
index 689ae2c..fe790fc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2020-2023 Nordix Foundation.
+ *  Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
  *  Modifications Copyright (C) 2020-2021 Pantheon.tech
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,6 +28,7 @@ import jakarta.persistence.GenerationType;
 import jakarta.persistence.Id;
 import jakarta.persistence.Table;
 import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
 import java.io.Serializable;
 import lombok.AllArgsConstructor;
 import lombok.EqualsAndHashCode;
@@ -48,6 +49,7 @@ import lombok.Setter;
 @EqualsAndHashCode(onlyExplicitlyIncluded = true)
 public class DataspaceEntity implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = 8395254649813051882L;
 
     @Id
index 2c851b6..e4cdc7f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- * Copyright (C) 2020-2024 Nordix Foundation.
+ * Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
  * Modifications Copyright (C) 2021 Pantheon.tech
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,6 +34,7 @@ import jakarta.persistence.OneToMany;
 import jakarta.persistence.SequenceGenerator;
 import jakarta.persistence.Table;
 import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
 import java.io.Serializable;
 import java.util.Set;
 import lombok.AllArgsConstructor;
@@ -61,6 +62,7 @@ import org.hibernate.type.SqlTypes;
 @EqualsAndHashCode(onlyExplicitlyIncluded = true)
 public class FragmentEntity implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = 7737669789097119667L;
 
     @Id
index e99f79e..e223f6c 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -31,6 +32,7 @@ import jakarta.persistence.ManyToMany;
 import jakarta.persistence.ManyToOne;
 import jakarta.persistence.Table;
 import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
 import java.io.Serializable;
 import java.util.Set;
 import lombok.Getter;
@@ -47,6 +49,7 @@ import lombok.Setter;
 @Table(name = "schema_set")
 public class SchemaSetEntity implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = 6665056955069047269L;
 
     @Id
index 2b2d792..51650f7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
- *  Modifications Copyright (C) 2021-2023 Nordix Foundation
+ *  Modifications Copyright (C) 2021-2025 OpenInfra Foundation Europe.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import jakarta.persistence.Id;
 import jakarta.persistence.ManyToMany;
 import jakarta.persistence.Table;
 import jakarta.validation.constraints.NotNull;
+import java.io.Serial;
 import java.io.Serializable;
 import java.util.Set;
 import lombok.Getter;
@@ -44,6 +45,7 @@ import lombok.Setter;
 @Table(name = "yang_resource")
 public class YangResourceEntity implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = -4496883162142106774L;
 
     @Id
index 3b88748..82b167f 100644 (file)
@@ -42,6 +42,7 @@ import org.onap.cps.ri.models.FragmentEntity;
 import org.onap.cps.ri.utils.EscapeUtils;
 import org.springframework.stereotype.Component;
 
+@SuppressWarnings("unused")
 @RequiredArgsConstructor
 @Component
 public class FragmentQueryBuilder {
@@ -362,6 +363,7 @@ public class FragmentQueryBuilder {
         }
     }
 
+    @SuppressWarnings("SameParameterValue")
     private static <V> String substitute(final String template, final Map<String, V> valueMap) {
         final StringSubstitutor stringSubstitutor = new StringSubstitutor(valueMap);
         return stringSubstitutor.replace(template);
index a24b280..fe29a73 100644 (file)
@@ -35,7 +35,7 @@ public interface FragmentRepositoryCpsPathQuery {
                                                 int queryResultLimit);
 
     <T> Set<T> findAttributeValuesByAnchorAndCpsPath(AnchorEntity anchorEntity, CpsPathQuery cpsPathQuery,
-                                                     String attributeName, int queryResultLimit, Class<T> targetClass);
+                                                     int queryResultLimit, Class<T> targetClass);
 
     List<FragmentEntity> findByDataspaceAndCpsPath(DataspaceEntity dataspaceEntity,
                                                    CpsPathQuery cpsPathQuery, List<Long> anchorIds);
index cc8055d..ac9939c 100644 (file)
@@ -35,6 +35,7 @@ import org.onap.cps.ri.models.DataspaceEntity;
 import org.onap.cps.ri.models.FragmentEntity;
 import org.onap.cps.utils.JsonObjectMapper;
 
+@SuppressWarnings("unused")
 @RequiredArgsConstructor
 @Slf4j
 public class FragmentRepositoryCpsPathQueryImpl implements FragmentRepositoryCpsPathQuery {
@@ -49,6 +50,7 @@ public class FragmentRepositoryCpsPathQueryImpl implements FragmentRepositoryCps
                                                        final int queryResultLimit) {
         final Query query = fragmentQueryBuilder.getQueryForAnchorAndCpsPath(anchorEntity, cpsPathQuery,
                 queryResultLimit);
+        @SuppressWarnings("unchecked")
         final List<FragmentEntity> fragmentEntities = query.getResultList();
         log.debug("Fetched {} fragment entities by anchor and cps path.", fragmentEntities.size());
         if (queryResultLimit > 0) {
@@ -61,11 +63,11 @@ public class FragmentRepositoryCpsPathQueryImpl implements FragmentRepositoryCps
     @Transactional
     public <T> Set<T> findAttributeValuesByAnchorAndCpsPath(final AnchorEntity anchorEntity,
                                                             final CpsPathQuery cpsPathQuery,
-                                                            final String attributeName,
                                                             final int queryResultLimit,
                                                             final Class<T> targetClass) {
         final Query query = fragmentQueryBuilder.getQueryForAnchorAndCpsPath(anchorEntity, cpsPathQuery,
                 queryResultLimit);
+        @SuppressWarnings("unchecked")
         final List<String> jsonResultList = query.getResultList();
         return jsonResultList.stream()
                 .map(jsonValue -> jsonObjectMapper.convertJsonString(jsonValue, targetClass))
@@ -75,9 +77,11 @@ public class FragmentRepositoryCpsPathQueryImpl implements FragmentRepositoryCps
     @Override
     @Transactional
     public List<FragmentEntity> findByDataspaceAndCpsPath(final DataspaceEntity dataspaceEntity,
-                                                          final CpsPathQuery cpsPathQuery, final List<Long> anchorIds) {
+                                                          final CpsPathQuery cpsPathQuery,
+                                                          final List<Long> anchorIds) {
         final Query query = fragmentQueryBuilder.getQueryForDataspaceAndCpsPath(
                 dataspaceEntity, cpsPathQuery, anchorIds);
+        @SuppressWarnings("unchecked")
         final List<FragmentEntity> fragmentEntities = query.getResultList();
         log.debug("Fetched {} fragment entities by cps path across all anchors.", fragmentEntities.size());
         return fragmentEntities;
index 7611dcd..dbc3eeb 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022-2025 Nordix Foundation.
+ *  Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import lombok.SneakyThrows;
 import org.onap.cps.api.model.ModuleReference;
 import org.springframework.transaction.annotation.Transactional;
 
+@SuppressWarnings("unused")
 @Transactional
 @RequiredArgsConstructor
 public class ModuleReferenceRepositoryImpl implements ModuleReferenceQuery {
index 06ac125..c672673 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation
+ *  Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -100,8 +100,9 @@ public class SessionManager {
      * @param commit indicator whether session will commit or rollback
      */
     public void closeSession(final String sessionId, final boolean commit) {
+        Session session = null;
         try {
-            final Session session = getSession(sessionId);
+            session = getSession(sessionId);
             if (commit) {
                 session.getTransaction().commit();
             } else {
@@ -112,7 +113,9 @@ public class SessionManager {
             throw new SessionManagerException("Cannot close session",
                 String.format("Unable to close session with session ID '%s'", sessionId), e);
         } finally {
-            sessionMap.remove(sessionId);
+            if (session != null) {
+                sessionMap.remove(sessionId);
+            }
         }
     }
 
index 0b22042..2da2ceb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2021-2023 Nordix Foundation
+ *  Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  *  Modifications Copyright (C) 2021 Pantheon.tech
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
 import java.util.Collection;
 import java.util.Collections;
 import lombok.Getter;
@@ -32,6 +33,7 @@ import lombok.Getter;
 @SuppressWarnings("squid:S110")  // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class AlreadyDefinedException extends CpsAdminException {
 
+    @Serial
     private static final long serialVersionUID = 501929839139881112L;
     public static final String ALREADY_DEFINED_EXCEPTION_MESSAGE = "Already defined exception";
 
@@ -45,10 +47,10 @@ public class AlreadyDefinedException extends CpsAdminException {
         alreadyDefinedObjectNames = Collections.singletonList(objectName);
     }
 
-    private AlreadyDefinedException(final String objectType, final Collection<String> objectNames,
+    private AlreadyDefinedException(final Collection<String> objectNames,
                                     final String contextName) {
         super(ALREADY_DEFINED_EXCEPTION_MESSAGE,
-                String.format("%d %s already exist for %s.", objectNames.size(), objectType, contextName));
+                String.format("%d data node(s) already exist for %s.", objectNames.size(), contextName));
         alreadyDefinedObjectNames = objectNames;
     }
 
@@ -72,6 +74,6 @@ public class AlreadyDefinedException extends CpsAdminException {
     }
 
     public static AlreadyDefinedException forDataNodes(final Collection<String> xpaths, final String contextName) {
-        return new AlreadyDefinedException("data node(s)", xpaths, contextName);
+        return new AlreadyDefinedException(xpaths, contextName);
     }
 }
index 27ba296..a63db14 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation.
+ *  Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 @SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class AnchorNotFoundException extends CpsAdminException {
 
+    @Serial
     private static final long serialVersionUID = -1821064664642194882L;
 
     /**
index de51815..d229a85 100644 (file)
@@ -1,29 +1,34 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Bell Canada. All rights reserved.
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * CPS Admin exception.
  */
 public class CpsAdminException extends CpsException {
 
+    @Serial
     private static final long serialVersionUID = 5573438585188332404L;
 
     /**
index e2b2b7b..abd89dc 100644 (file)
@@ -1,24 +1,27 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
 import lombok.Getter;
 
 /**
@@ -26,6 +29,7 @@ import lombok.Getter;
  */
 public class CpsException extends RuntimeException {
 
+    @Serial
     private static final long serialVersionUID = 1592619410918497467L;
 
     @Getter
index 00664de..aa4a55f 100644 (file)
@@ -1,27 +1,30 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Copyright (C) 2021-2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
  *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 public class CpsPathException extends CpsException {
 
+    @Serial
     private static final long serialVersionUID = 1006899957127327791L;
 
     private static final String ERROR_MESSAGE = "Error while parsing cpsPath expression";
index 6127608..fc995a0 100644 (file)
@@ -1,29 +1,34 @@
 /*
- *  ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Pantheon.tech
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * Runtime exception. Thrown when data record rejected to be deleted because it's being referenced by other data.
  */
 public class DataInUseException extends CpsException {
 
+    @Serial
     private static final long serialVersionUID = 5011830482789788314L;
 
     /**
index 521b786..e890f9f 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation
+ *  Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * DataNode Not Found Exception. Indicates the requested data being absent.
  */
 @SuppressWarnings("squid:S110")  // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class DataNodeNotFoundException extends DataValidationException {
 
+    @Serial
     private static final long serialVersionUID = 7786740001662205407L;
     private static final String DATANODE_NOT_FOUND = "DataNode not found";
     /**
index 5306819..1548315 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
- *  Modifications Copyright (C) 2020-2021 Nordix Foundation
+ *  Modifications Copyright (C) 2020-2025 OpenInfra Foundation Europe.
  *  Modifications Copyright (C) 2020 Bell Canada.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 public class DataValidationException extends CpsException {
 
+    @Serial
     private static final long serialVersionUID = 7747941311132087621L;
 
     /**
index 8ceaf1a..0508c85 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation.
+ *  Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * Runtime exception.
  * Thrown when given dataspace name is rejected to be deleted because it has anchor or schemasets associated.
@@ -26,6 +28,7 @@ package org.onap.cps.api.exceptions;
 @SuppressWarnings("squid:S110")  // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class DataspaceInUseException extends DataInUseException {
 
+    @Serial
     private static final long serialVersionUID = 4531370947720760347L;
 
     /**
index 0be2fec..77e6bcc 100644 (file)
@@ -1,24 +1,28 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Bell Canada. All rights reserved.
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * Dataspace Not Found Exception. Indicates the requested data being absent.
  */
@@ -26,6 +30,7 @@ package org.onap.cps.api.exceptions;
 @SuppressWarnings("squid:S110")  // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class DataspaceNotFoundException extends CpsAdminException {
 
+    @Serial
     private static final long serialVersionUID = -1852996415384288431L;
 
     /**
index 0dec574..f8527e4 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * ============LICENSE_START=======================================================
- * Copyright (c) 2021 Bell Canada.
+ *  Copyright (c) 2021 Bell Canada.
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
 import lombok.Getter;
 
 /**
@@ -26,6 +30,7 @@ import lombok.Getter;
 @Getter
 public class DuplicatedYangResourceException extends CpsException {
 
+    @Serial
     private static final long serialVersionUID = 9085557087319212380L;
 
     private final String name;
index d38fe8d..85d1c3c 100644 (file)
@@ -1,29 +1,34 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Bell Canada. All rights reserved.
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * Yang Model Validation exception.
  */
 public class ModelValidationException extends CpsException {
 
+    @Serial
     private static final long serialVersionUID = 650368325928748496L;
 
     /**
index 977ecec..3df2114 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2021 Nordix Foundation.
+ *  Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
 import java.util.Collection;
 
 @SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class ModuleNamesNotFoundException extends CpsAdminException {
 
+    @Serial
     private static final long serialVersionUID = 3105694256583924137L;
 
     /**
index 71322b7..150ed02 100644 (file)
@@ -1,29 +1,34 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * Not found in dataspace exception. Indicates the requested data being absent in a given dataspace
  */
 public class NotFoundInDataspaceException extends CpsException {
 
+    @Serial
     private static final long serialVersionUID = 3838769447129047713L;
 
     public NotFoundInDataspaceException(final String dataspaceName, final String descriptionOfObject) {
index 4d481be..e19a522 100644 (file)
@@ -1,30 +1,35 @@
 /*
- *  ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Pantheon.tech
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * Runtime exception. Thrown when schema set record rejected to be deleted because it has anchor records associated.
  */
 @SuppressWarnings("squid:S110")  // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class SchemaSetInUseException extends DataInUseException {
 
+    @Serial
     private static final long serialVersionUID = -3729328573253023683L;
 
     /**
index e95d907..33b8d4e 100644 (file)
@@ -1,24 +1,28 @@
 /*
- *  ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
  *
- *  SPDX-License-Identifier: Apache-2.0
- *  ============LICENSE_END=========================================================
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
  */
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 /**
  * Schema set not found exception. Indicates the schema set is not found in a given dataspace
  */
@@ -26,6 +30,7 @@ package org.onap.cps.api.exceptions;
 @SuppressWarnings("squid:S110")  // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class SchemaSetNotFoundException extends CpsAdminException {
 
+    @Serial
     private static final long serialVersionUID = 7422782395935450035L;
 
     /**
index d1f32c0..e87cc69 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation
+ *  Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
 package org.onap.cps.api.exceptions;
 
 
+import java.io.Serial;
+
 public class SessionManagerException extends CpsException {
 
+    @Serial
     private static final long serialVersionUID = 7957090904519019500L;
 
     /**
index 6b45e1b..dd634ce 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation
+ *  Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
 
 package org.onap.cps.api.exceptions;
 
+import java.io.Serial;
+
 @SuppressWarnings("squid:S110")  // Team agreed to accept 6 levels of inheritance for CPS Exceptions
 public class SessionTimeoutException extends SessionManagerException {
 
+    @Serial
     private static final long serialVersionUID = -8809577494038691360L;
 
     public SessionTimeoutException(final String message, final String details, final Throwable cause) {
index 68f7920..a5a5b45 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2020 Nordix Foundation.
+ *  Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 
 package org.onap.cps.api.model;
 
+import java.io.Serial;
 import java.io.Serializable;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -32,6 +33,7 @@ import lombok.NoArgsConstructor;
 @AllArgsConstructor
 public class Anchor implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = 1464791260718603291L;
 
     private String name;
index 6597aa3..3d24159 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- * Copyright (C) 2020-2022 Nordix Foundation.
+ * Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved.
  * Modifications Copyright (C) 2021 Bell Canada.
  * Modifications Copyright (C) 2021 Pantheon.tech
  * ================================================================================
@@ -22,6 +22,7 @@
 
 package org.onap.cps.api.model;
 
+import java.io.Serial;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
@@ -37,6 +38,7 @@ import lombok.Setter;
 @NoArgsConstructor
 public class DataNode implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = 1482619410918597467L;
 
     private String dataspace;
index 238b861..8f1fad5 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2022 TechMahindra Ltd.
+ *  Modifications (C) 2025 OpenInfra Foundation Europe.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
 
 package org.onap.cps.api.model;
 
+import java.io.Serial;
 import java.io.Serializable;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -36,6 +38,7 @@ import lombok.Setter;
 @EqualsAndHashCode
 public class Dataspace implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = 1464791062718603291L;
 
     private String name;
index c2f23d6..03a2fb8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2022-2024 Nordix Foundation
+ *  Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 
 package org.onap.cps.api.model;
 
+import java.io.Serial;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.Setter;
@@ -31,6 +32,7 @@ import lombok.ToString;
 @ToString
 public class ModuleDefinition extends ModuleReference {
 
+    @Serial
     private static final long serialVersionUID = -6591435720836327732L;
     private final String content;
 
@@ -38,4 +40,4 @@ public class ModuleDefinition extends ModuleReference {
         super(moduleName, revision);
         this.content = content;
     }
-}
\ No newline at end of file
+}
index a93a510..adc618a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 
 package org.onap.cps.api.model;
 
+import java.io.Serial;
 import java.io.Serializable;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -32,6 +33,7 @@ import lombok.NoArgsConstructor;
 @AllArgsConstructor
 public class ModuleReference implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = -1761408847591042599L;
     private String moduleName;
     private String revision;
index be57d2d..d7a62a6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Pantheon.tech
- *  Modifications Copyright (C) 2022 Nordix Foundation.
+ *  Modifications Copyright (C) 2022-2025 OpenInfra Foundation Europe.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
 
 package org.onap.cps.api.model;
 
+import java.io.Serial;
 import java.io.Serializable;
 import java.util.List;
 import lombok.AllArgsConstructor;
@@ -34,6 +35,7 @@ import lombok.NoArgsConstructor;
 @AllArgsConstructor
 public class SchemaSet implements Serializable {
 
+    @Serial
     private static final long serialVersionUID = 1464791260718603291L;
     private String name;
     private String dataspaceName;
index 01e1ad1..ee65e3a 100644 (file)
@@ -44,7 +44,7 @@ public class EventsProducer<T> {
 
     /**
      * KafkaTemplate for legacy (non-cloud) events.
-     * Note: Cloud events should be used. This will be addressed as part of  https://lf-onap.atlassian.net/browse/CPS-1717.
+     * Note: Cloud events should be used. This will be addressed as part of  <a href="https://lf-onap.atlassian.net/browse/CPS-1717">...</a>.
      */
     private final KafkaTemplate<String, T> legacyKafkaEventTemplate;
 
@@ -73,7 +73,7 @@ public class EventsProducer<T> {
 
     /**
      * Generic Event sender.
-     * Note: Cloud events should be used. This will be addressed as part of  https://lf-onap.atlassian.net/browse/CPS-1717.
+     * Note: Cloud events should be used. This will be addressed as part of  <a href="https://lf-onap.atlassian.net/browse/CPS-1717">...</a>.
      *
      * @param topicName valid topic name
      * @param eventKey  message key
index a78f3d9..e9c11a7 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Bell Canada. All rights reserved.
  *  Modifications Copyright (C) 2021 Pantheon.tech
- *  Modifications Copyright (C) 2022-2024 Nordix Foundation.
+ *  Modifications Copyright (C) 2022-2025 OpenInfra Foundation Europe.
  *  Modifications Copyright (C) 2022-2023 TechMahindra Ltd.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -193,11 +193,9 @@ public class DataNodeBuilder {
     }
 
     private Collection<DataNode> buildCollectionFromContainerNode() {
-        final var parentDataNode = new DataNodeBuilder().withXpath(parentNodeXpath).build();
-        if (containerNode.body() != null) {
-            for (final NormalizedNode normalizedNode: containerNode.body()) {
-                addDataNodeFromNormalizedNode(parentDataNode, normalizedNode);
-            }
+        final DataNode parentDataNode = new DataNodeBuilder().withXpath(parentNodeXpath).build();
+        for (final NormalizedNode normalizedNode : containerNode.body()) {
+            addDataNodeFromNormalizedNode(parentDataNode, normalizedNode);
         }
         return parentDataNode.getChildDataNodes();
     }
index e7e7b1c..0a35813 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Pantheon.tech
  *  Modifications Copyright (C) 2022 Bell Canada
- *  Modifications Copyright (C) 2022-2025 Nordix Foundation
+ *  Modifications Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -74,6 +74,7 @@ public class YangTextSchemaSourceSetCache {
      * @param yangTextSchemaSourceSet yangTextSchemaSourceSet
      * @return YangTextSchemaSourceSet
      */
+    @SuppressWarnings("unused")
     @CachePut(key = "#p0.concat('-').concat(#p1)")
     @CanIgnoreReturnValue
     public YangTextSchemaSourceSet updateCache(final String dataspaceName, final String schemaSetName,
@@ -89,6 +90,7 @@ public class YangTextSchemaSourceSetCache {
      * @param dataspaceName dataspace name
      * @param schemaSetName schema set name
      */
+    @SuppressWarnings("unused")
     @CacheEvict(key = "#p0.concat('-').concat(#p1)")
     public void removeFromCache(final String dataspaceName, final String schemaSetName) {
         cpsValidator.validateNameCharacters(dataspaceName);
index 01093d7..dfe3a38 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2022 Deutsche Telekom AG
- *  Modifications Copyright (C) 2023-2024 Nordix Foundation.
+ *  Modifications Copyright (C) 2023-2025 OpenInfra Foundation Europe.
  *  Modifications Copyright (C) 2024-2025 TechMahindra Ltd.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -170,6 +170,7 @@ public class XmlFileUtils {
      * @param dataMaps List of data maps to convert
      * @return XML string representation of the data maps
      */
+    @SuppressWarnings("unchecked")
     @SuppressFBWarnings(value = "DCN_NULLPOINTER_EXCEPTION")
     public static String convertDataMapsToXml(final Object dataMaps) {
         try {
@@ -206,6 +207,7 @@ public class XmlFileUtils {
         }
     }
 
+    @SuppressWarnings("unchecked")
     private static void appendList(final Document document, final Node parentNode,
                                    final Map.Entry<String, Object> dataNodeMapEntry) {
         final List<Object> dataNodeMaps = (List<Object>) dataNodeMapEntry.getValue();
@@ -227,6 +229,7 @@ public class XmlFileUtils {
         }
     }
 
+    @SuppressWarnings("unchecked")
     private static void appendMap(final Document document, final Node parentNode,
                                   final Map.Entry<String, Object> dataNodeMapEntry) {
         final Element childElement = document.createElement(dataNodeMapEntry.getKey());
@@ -253,8 +256,8 @@ public class XmlFileUtils {
         return writer.toString();
     }
 
+    @SuppressWarnings("SameReturnValue")
     private static DocumentBuilderFactory getDocumentBuilderFactory() {
-
         if (isNewDocumentBuilderFactoryInstance) {
             documentBuilderFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
             documentBuilderFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
@@ -264,8 +267,8 @@ public class XmlFileUtils {
         return documentBuilderFactory;
     }
 
+    @SuppressWarnings("SameReturnValue")
     private static TransformerFactory getTransformerFactory() {
-
         if (isNewTransformerFactoryInstance) {
             transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
             transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
index 83f7ce2..be2c657 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2024 Nordix Foundation
+ *  Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -193,6 +193,7 @@ public class YangParserHelper {
         return Builders.containerBuilder().withChild(dataContainerChild).withNodeIdentifier(nodeIdentifier).build();
     }
 
+    @SuppressWarnings("unchecked")
     private static Collection<QName> getDataSchemaNodeIdentifiers(final SchemaContext schemaContext,
                                                                   final String parentNodeXpath) {
         return (Collection<QName>) getDataSchemaNodeAndIdentifiersByXpath(parentNodeXpath, schemaContext)
@@ -250,6 +251,7 @@ public class YangParserHelper {
 
     private static NormalizedNode getFirstChildXmlRoot(final NormalizedNode parent) {
         final String rootNodeType = parent.getIdentifier().getNodeType().getLocalName();
+        @SuppressWarnings("unchecked")
         final Collection<DataContainerChild> children = (Collection<DataContainerChild>) parent.body();
         final Iterator<DataContainerChild> iterator = children.iterator();
         NormalizedNode child = null;
index efbe488..b33d7a8 100644 (file)
@@ -29,13 +29,13 @@ import io.micrometer.core.annotation.Timed;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 import lombok.NoArgsConstructor;
 import org.onap.cps.api.exceptions.ModelValidationException;
 import org.onap.cps.api.model.ModuleReference;
@@ -142,7 +142,7 @@ public final class YangTextSchemaSourceSetBuilder {
         try {
             return yangParser.buildEffectiveModel();
         } catch (final YangParserException yangParserException) {
-            final List<String> resourceNames = yangResourceNameToContent.keySet().stream().collect(Collectors.toList());
+            final List<String> resourceNames = new ArrayList<>(yangResourceNameToContent.keySet());
             Collections.sort(resourceNames);
             throw new ModelValidationException("Invalid schema set.",
                 String.format("Effective schema context build failed for resources %s.", resourceNames),
index 28ba0a9..5b9a961 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Pantheon.tech
- *  Modifications Copyright (C) 2021-2024 Nordix Foundation.
+ *  Modifications Copyright (C) 2021-2025 OpenInfra Foundation Europe.
  *  Modifications Copyright (C) 2022 TechMahindra Ltd.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -179,11 +179,7 @@ class DataNodeBuilderSpec extends Specification {
 
     def 'Converting ContainerNode to a Collection with #scenario.'() {
         expect: 'converting null to a collection returns an empty collection'
-            assert objectUnderTest.withContainerNode(containerNode).buildCollection().isEmpty()
-        where: 'the following container node is used'
-            scenario              | containerNode
-            'null object'         | null
-            'object without body' | Mock(ContainerNode)
+            assert objectUnderTest.withContainerNode(null).buildCollection().isEmpty()
     }
 
     def 'Converting ContainerNode to a DataNode with unsupported Normalized Node.'() {
index 0eb7b37..6f3fb95 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2024 Nordix Foundation
+ *  Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ public class PolicyExecutorStubController implements OperationPermissionApi {
     private final Sleeper sleeper;
     private static final Pattern ERROR_CODE_PATTERN = Pattern.compile("(\\d{3})");
     private int decisionCounter = 0;
-    // Do NOT change below to final as it needs to be set during test
+    @SuppressWarnings("CanBeFinal") // Do NOT change below to final as it needs to be set during test
     private static int slowResponseTimeInSeconds = 40;
 
     @Override
@@ -59,7 +59,7 @@ public class PolicyExecutorStubController implements OperationPermissionApi {
         final Operation firstOperation = permissionRequest.getOperations().iterator().next();
         log.info("1st Operation: {}", firstOperation.getOperation());
         if (!"delete".equals(firstOperation.getOperation()) && firstOperation.getChangeRequest() == null) {
-            log.warn("Change Request is required for " + firstOperation.getOperation() + " operations");
+            log.warn("Change Request is required for {} operations", firstOperation.getOperation());
             return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
         }
         return handleOperation(firstOperation);
@@ -71,7 +71,7 @@ public class PolicyExecutorStubController implements OperationPermissionApi {
         final Matcher matcher = ERROR_CODE_PATTERN.matcher(targetIdentifier);
         if (matcher.find()) {
             final int errorCode = Integer.parseInt(matcher.group(1));
-            log.warn("Stub is mocking an error response, code: " + errorCode);
+            log.warn("Stub is mocking an error response, code: {}", errorCode);
             return new ResponseEntity<>(HttpStatusCode.valueOf(errorCode));
         }