diff options
author | 2021-05-06 16:39:17 -0400 | |
---|---|---|
committer | 2021-05-06 16:48:30 -0400 | |
commit | 8cd519ee397bd6661eddfeea1b989a99d1caac2e (patch) | |
tree | 0770d461c5afd76ecf7e603885cb7f2e936c654c /main/src | |
parent | a05cc62b6426d31c23f60dbe4a6f367331431ea4 (diff) |
Fix sonars in policy-distribution
Fixed:
- use "var" instead of actual type
Issue-ID: POLICY-3285
Change-Id: I0dba2f96870722b4071ac0085287bc91a27dde88
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src')
6 files changed, 14 insertions, 12 deletions
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java index 7807dcc1..f8eb2758 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java +++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java @@ -22,7 +22,6 @@ package org.onap.policy.distribution.main.parameters; -import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.FileReader; import org.onap.policy.common.parameters.ValidationResult; @@ -55,7 +54,7 @@ public class DistributionParameterHandler { // Read the parameters try { // Read the parameters from JSON using Gson - final Gson gson = new GsonBuilder() + final var gson = new GsonBuilder() .registerTypeAdapter(PolicyForwarderConfigurationParameterGroup.class, new PolicyForwarderConfigurationParametersJsonAdapter()) .registerTypeAdapter(ReceptionHandlerConfigurationParameterGroup.class, diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParametersJsonAdapter.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParametersJsonAdapter.java index 3370a95f..b171ce3a 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParametersJsonAdapter.java +++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParametersJsonAdapter.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2020 AT&T Inc. + * Modifications Copyright (C) 2020-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. @@ -45,7 +45,7 @@ public class PolicyForwarderConfigurationParametersJsonAdapter @Override public PolicyForwarderConfigurationParameterGroup deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) { - final JsonObject jsonObject = json.getAsJsonObject(); + final var jsonObject = json.getAsJsonObject(); final String policyForwarderParameterClassName = getParameterGroupClassName(jsonObject); final Class<?> policyForwarderParameterClass = getParameterGroupClass(policyForwarderParameterClassName); @@ -54,7 +54,7 @@ public class PolicyForwarderConfigurationParametersJsonAdapter } private String getParameterGroupClassName(final JsonObject jsonObject) { - final JsonPrimitive classNameJsonPrimitive = ((JsonPrimitive) jsonObject.get(PARAMETER_CLASS_NAME)); + final var classNameJsonPrimitive = ((JsonPrimitive) jsonObject.get(PARAMETER_CLASS_NAME)); if (classNameJsonPrimitive == null || classNameJsonPrimitive.getAsString().length() == 0) { final String errorMessage = "parameter \"" + PARAMETER_CLASS_NAME + "\" value \"" diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java b/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java index 2fe46b22..e4ebffef 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java +++ b/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 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. @@ -43,7 +44,7 @@ public class HealthCheckProvider { * @return Report containing health check status */ public HealthCheckReport performHealthCheck() { - final HealthCheckReport report = new HealthCheckReport(); + final var report = new HealthCheckReport(); report.setName(NAME); report.setUrl(URL); report.setHealthy(DistributionActivator.isAlive()); diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/StatisticsProvider.java b/main/src/main/java/org/onap/policy/distribution/main/rest/StatisticsProvider.java index 7532ac61..426436fb 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/rest/StatisticsProvider.java +++ b/main/src/main/java/org/onap/policy/distribution/main/rest/StatisticsProvider.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * 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. @@ -36,7 +37,7 @@ public class StatisticsProvider { * @return Report containing statistics of distribution service */ public StatisticsReport fetchCurrentStatistics() { - final StatisticsReport report = new StatisticsReport(); + final var report = new StatisticsReport(); report.setCode(DistributionActivator.isAlive() ? 200 : 500); report.setTotalDistributionCount(DistributionStatisticsManager.getTotalDistributionCount()); report.setDistributionSuccessCount(DistributionStatisticsManager.getDistributionSuccessCount()); diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/StatisticsReport.java b/main/src/main/java/org/onap/policy/distribution/main/rest/StatisticsReport.java index 4cbbcd70..8b275501 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/rest/StatisticsReport.java +++ b/main/src/main/java/org/onap/policy/distribution/main/rest/StatisticsReport.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * 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. @@ -167,7 +168,7 @@ public class StatisticsReport { */ @Override public String toString() { - final StringBuilder builder = new StringBuilder(); + final var builder = new StringBuilder(); builder.append("StatisticsReport [code="); builder.append(getCode()); builder.append(", totalDistributionCount="); diff --git a/main/src/main/java/org/onap/policy/distribution/main/startstop/Main.java b/main/src/main/java/org/onap/policy/distribution/main/startstop/Main.java index 83eee73c..64215e82 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/startstop/Main.java +++ b/main/src/main/java/org/onap/policy/distribution/main/startstop/Main.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2020 AT&T Inc. + * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ @@ -54,11 +54,11 @@ public class Main { * @param args the command line arguments */ public Main(final String[] args) { - final String argumentString = Arrays.toString(args); + final var argumentString = Arrays.toString(args); LOGGER.info("Starting policy distribution service with arguments - {}", argumentString); // Check the arguments - final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments(); + final var arguments = new DistributionCommandLineArguments(); try { // The arguments return a string if there is a message to print and we should exit final String argumentMessage = arguments.parse(args); @@ -85,7 +85,7 @@ public class Main { // Add a shutdown hook to shut everything down in an orderly manner Runtime.getRuntime().addShutdownHook(new PolicyDistributionShutdownHookClass()); - String successMsg = String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_DISTRIBUTION); + var successMsg = String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_DISTRIBUTION); LOGGER.info(successMsg); } |