From cc035870af8fa909fc19774f0b9382cf00e051a8 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 10 May 2021 12:52:21 -0400 Subject: Fix sonars in policy-gui Fixed: - use "var" Only fixed the ones I saw visually, as SonarLint wouldn't run - something about missing node.js. Issue-ID: POLICY-3094 Change-Id: I594d424b42ce446d86724d75b1dd9ec868c14f2b Signed-off-by: Jim Hahn --- .../java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java | 7 +++---- .../gui/pdp/monitoring/PdpMonitoringServerParameterParser.java | 7 ++++--- .../policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'gui-pdp-monitoring/src/main') diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java index 4324124..385e2b5 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java @@ -25,7 +25,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import lombok.Getter; import lombok.ToString; -import org.onap.policy.common.parameters.ValidationResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,7 +67,7 @@ public class PdpMonitoringMain { public PdpMonitoringMain(final String[] args) { // Server parameter parsing - final PdpMonitoringServerParameterParser parser = new PdpMonitoringServerParameterParser(); + final var parser = new PdpMonitoringServerParameterParser(); try { // Get and check the parameters @@ -83,7 +82,7 @@ public class PdpMonitoringMain { } // Validate the parameters - final ValidationResult validationResult = parameters.validate(); + final var validationResult = parameters.validate(); if (!validationResult.isValid()) { throw new PdpMonitoringServerParameterException( PDP_MONITORING_PREFIX + this + ") parameters invalid, " + validationResult.getResult() + '\n' @@ -180,7 +179,7 @@ public class PdpMonitoringMain { */ public static void main(final String[] args) { try { - final PdpMonitoringMain main = new PdpMonitoringMain(args); + final var main = new PdpMonitoringMain(args); main.init(); } catch (final Exception e) { LOGGER.error("start failed", e); 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 5d9d290..76fa005 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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. @@ -66,7 +67,7 @@ public class PdpMonitoringServerParameterParser { throw new PdpMonitoringServerParameterException("invalid command line arguments specified", e); } - final PdpMonitoringServerParameters parameters = new PdpMonitoringServerParameters(); + final var parameters = new PdpMonitoringServerParameters(); final String[] remainingArgs = commandLine.getArgs(); if (commandLine.getArgs().length > 0) { @@ -102,8 +103,8 @@ public class PdpMonitoringServerParameterParser { * @return help string */ public String getHelp(final String mainClassName) { - final StringWriter stringWriter = new StringWriter(); - final PrintWriter stringPrintWriter = new PrintWriter(stringWriter); + final var stringWriter = new StringWriter(); + final var stringPrintWriter = new PrintWriter(stringWriter); final HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp(stringPrintWriter, 120, mainClassName + " [options...] ", "", options, 0, 0, ""); 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 bb11c26..419fe04 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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. @@ -119,7 +120,7 @@ public class PdpMonitoringRestResource { @QueryParam("username") final String username, @QueryParam("password") final String password, @QueryParam("id") final String id) throws HttpClientConfigException, CoderException { - PdpGroups pdpGroups = getHttpClient(useHttps, hostname, port, username, password, "policy/pap/v1/pdps").get() + var pdpGroups = getHttpClient(useHttps, hostname, port, username, password, "policy/pap/v1/pdps").get() .readEntity(PdpGroups.class); String groupName; String subGroup; @@ -139,7 +140,7 @@ public class PdpMonitoringRestResource { .filter(instance -> instance.getInstanceId().equals(instanceId))) .filter(Objects::nonNull).findFirst().orElseThrow(); - final StatisticsResponse responseObject = new StatisticsResponse(); + final var responseObject = new StatisticsResponse(); // Engine Service data responseObject.setEngineId(pdp.getInstanceId()); @@ -204,7 +205,7 @@ public class PdpMonitoringRestResource { private HttpClient getHttpClient(String useHttps, String hostname, int port, String username, String password, String basePath) throws HttpClientConfigException { - BusTopicParams busParams = new BusTopicParams(); + var busParams = new BusTopicParams(); busParams.setClientName("pdp-monitoring"); busParams.setHostname(hostname); busParams.setManaged(false); -- cgit 1.2.3-korg