From deec0f708a368eb979cf8d48d6221ee52cc919ad Mon Sep 17 00:00:00 2001 From: Ram Krishna Verma Date: Fri, 11 Jun 2021 16:01:27 -0400 Subject: Fix sonar in policy/gui use "var" for local variables Issue-ID: POLICY-3077 Change-Id: I6e31317bfda3d2b9bdde038cec709a3398f2f655 Signed-off-by: Ram Krishna Verma --- .../gui/pdp/monitoring/PdpMonitoringServerParameterParser.java | 3 ++- .../policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'gui-pdp-monitoring/src/main') diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java index 76fa005..7846b0e 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 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. @@ -106,7 +107,7 @@ public class PdpMonitoringServerParameterParser { final var stringWriter = new StringWriter(); final var stringPrintWriter = new PrintWriter(stringWriter); - final HelpFormatter helpFormatter = new HelpFormatter(); + final var helpFormatter = new HelpFormatter(); helpFormatter.printHelp(stringPrintWriter, 120, mainClassName + " [options...] ", "", options, 0, 0, ""); return stringWriter.toString(); diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java index 419fe04..ede9bee 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020-2021 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 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. @@ -45,7 +46,6 @@ import org.onap.policy.common.endpoints.http.client.HttpClientConfigException; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.models.pdp.concepts.Pdp; import org.onap.policy.models.pdp.concepts.PdpEngineWorkerStatistics; import org.onap.policy.models.pdp.concepts.PdpGroups; import org.onap.policy.models.pdp.concepts.PdpStatistics; @@ -134,7 +134,7 @@ public class PdpMonitoringRestResource { throw new IllegalArgumentException("Cannot parse groupName, subGroup and instanceId from " + id); } - Pdp pdp = pdpGroups.getGroups().stream().filter(group -> group.getName().equals(groupName)) + var pdp = pdpGroups.getGroups().stream().filter(group -> group.getName().equals(groupName)) .flatMap(group -> group.getPdpSubgroups().stream().filter(sub -> sub.getPdpType().equals(subGroup))) .flatMap(sub -> sub.getPdpInstances().stream() .filter(instance -> instance.getInstanceId().equals(instanceId))) @@ -157,7 +157,7 @@ public class PdpMonitoringRestResource { final List engineStatusList = new ArrayList<>(); if (!pdpStats.isEmpty()) { - PdpStatistics pdpStatistics = pdpStats.get(groupName).get(subGroup).get(0); + var pdpStatistics = pdpStats.get(groupName).get(subGroup).get(0); responseObject.setTimeStamp(pdpStatistics.getTimeStamp().toString()); responseObject.setPolicyDeployCount(pdpStatistics.getPolicyDeployCount()); responseObject.setPolicyDeploySuccessCount(pdpStatistics.getPolicyDeploySuccessCount()); @@ -169,7 +169,7 @@ public class PdpMonitoringRestResource { // Engine Status data for (final PdpEngineWorkerStatistics engineStats : pdpStatistics.getEngineStats()) { try { - final EngineStatus engineStatusObject = new EngineStatus(); + final var engineStatusObject = new EngineStatus(); engineStatusObject.setTimestamp(pdpStatistics.getTimeStamp().toString()); engineStatusObject.setId(engineStats.getEngineId()); engineStatusObject.setStatus(engineStats.getEngineWorkerState().name()); -- cgit 1.2.3-korg