Fix sonar security and maintainability issues 53/14253/1
authoraravind.est <aravindhan.a@est.tech>
Wed, 12 Mar 2025 15:17:54 +0000 (15:17 +0000)
committeraravind.est <aravindhan.a@est.tech>
Wed, 12 Mar 2025 15:17:54 +0000 (15:17 +0000)
One sonar security and 4 maintainability issues are fixed.

Issue-ID: NONRTRIC-1057
Change-Id: Ifbd7b4463a5e005fd5e481e24d7c6bee5c9cd740
Signed-off-by: aravind.est <aravindhan.a@est.tech>
rapp-manager-acm/src/test/java/org/oransc/rappmanager/acm/service/AcmDeployerTest.java
rapp-manager-application/src/main/java/org/oransc/rappmanager/rest/RappController.java
rapp-manager-application/src/test/java/org/oransc/rappmanager/service/DeploymentArtifactsServiceTest.java
rapp-manager-dme/src/test/java/org/oransc/rappmanager/dme/service/DmeDeployerTest.java
rapp-manager-sme/src/test/java/org/oransc/rappmanager/sme/service/SmeDeployerTest.java

index 406ec31..f176c7b 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START======================================================================
  * Copyright (C) 2023 Nordix Foundation. All rights reserved.
- * Copyright (C) 2023-2024 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2023-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.
@@ -114,7 +114,7 @@ class AcmDeployerTest {
     }
 
     @BeforeEach
-    public void init() {
+    void init() {
         mockServer = MockRestServiceServer.createServer(restTemplate);
     }
 
index 9638d5f..a5e698d 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START======================================================================
  * Copyright (C) 2023 Nordix Foundation. All rights reserved.
- * Copyright (C) 2023-2024 OpenInfra Foundation Europe. All rights reserved.
+ * Copyright (C) 2023-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.
@@ -92,7 +92,11 @@ public class RappController {
             rappCacheService.putRapp(rapp);
             return ResponseEntity.accepted().build();
         } else {
-            logger.info("Invalid Rapp package for {}", rappId);
+            if (rappId == null) {
+                logger.info("Invalid Rapp package with null rAppId");
+            } else {
+                logger.info("Invalid Rapp package for {}", rappId);
+            }
             throw new RappHandlerException(HttpStatus.BAD_REQUEST, "Invalid rApp package.");
         }
     }
index 854e205..d1978b2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START======================================================================
- * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * 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.
@@ -72,7 +72,7 @@ class DeploymentArtifactsServiceTest {
     private final String validRappFile = "valid-rapp-package.csar";
 
     @BeforeEach
-    public void init() {
+    void init() {
         mockServer = MockRestServiceServer.createServer(restTemplate);
     }
 
index dac4345..01bb422 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START======================================================================
  * Copyright (C) 2023 Nordix Foundation. All rights reserved.
- * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * 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.
@@ -98,7 +98,7 @@ class DmeDeployerTest {
     }
 
     @BeforeEach
-    public void init() {
+    void init() {
         mockServer = MockRestServiceServer.createServer(restTemplate);
     }
 
index f5cbe8a..2c58653 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START======================================================================
  * Copyright (C) 2023 Nordix Foundation. All rights reserved.
- * Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
+ * 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.
@@ -99,7 +99,7 @@ class SmeDeployerTest {
     }
 
     @BeforeEach
-    public void init() {
+    void init() {
         mockServer = MockRestServiceServer.createServer(restTemplate);
     }