Fix sonar issue SimulatorController 52/106352/2
authorAleksandra Maciaga <aleksandra.maciaga@nokia.com>
Tue, 21 Apr 2020 12:59:06 +0000 (14:59 +0200)
committerAleksandra Maciaga <aleksandra.maciaga@nokia.com>
Wed, 22 Apr 2020 07:35:08 +0000 (09:35 +0200)
Issue-ID: INT-1517
Signed-off-by: Aleksandra Maciaga <aleksandra.maciaga@nokia.com>
Change-Id: I7af9529be268cb40922868ee62e3318509166287

pnfsimulator/src/main/java/org/onap/pnfsimulator/rest/SimulatorController.java

index 401dc77..023b163 100644 (file)
@@ -94,11 +94,15 @@ public class SimulatorController {
         this.eventDataService = eventDataService;
     }
 
+    /**
+     * @deprecated
+     */
     @PostMapping("test")
     @Deprecated
     public ResponseEntity<Map<String,Object>> test(@Valid @RequestBody SimulatorRequest simulatorRequest) {
         MDC.put("test", "test");
-        LOGGER.info(ENTRY, simulatorRequest.toString());
+        String simulatorRequestString = simulatorRequest.toString();
+        LOGGER.info(ENTRY, simulatorRequestString);
         return buildResponse(OK, ImmutableMap.of(MESSAGE, "message1234"));
     }
 
@@ -138,6 +142,9 @@ public class SimulatorController {
         }
     }
 
+    /**
+     * @deprecated
+     */
     @GetMapping("all-events")
     @Deprecated
     public ResponseEntity<Map<String,Object>> allEvents() {
@@ -164,7 +171,8 @@ public class SimulatorController {
 
     @PostMapping("cancel/{jobName}")
     public ResponseEntity<Map<String,Object>> cancelEvent(@PathVariable String jobName) throws SchedulerException {
-        LOGGER.info(ENTRY, "Cancel called on {}.", replaceBreakingCharacters(jobName));
+        String jobNameNoBreakingCharacters = replaceBreakingCharacters(jobName);
+        LOGGER.info(ENTRY, "Cancel called on {}.", jobNameNoBreakingCharacters);
         boolean isCancelled = simulatorService.cancelEvent(jobName);
         return createCancelEventResponse(isCancelled);
     }