From 8cd519ee397bd6661eddfeea1b989a99d1caac2e Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 6 May 2021 16:39:17 -0400 Subject: Fix sonars in policy-distribution Fixed: - use "var" instead of actual type Issue-ID: POLICY-3285 Change-Id: I0dba2f96870722b4071ac0085287bc91a27dde88 Signed-off-by: Jim Hahn --- .../distribution/reception/handling/AbstractReceptionHandler.java | 4 ++-- .../onap/policy/distribution/reception/handling/PluginHandler.java | 4 ++-- .../parameters/PolicyDecoderConfigurationParametersJsonAdapter.java | 6 +++--- .../ReceptionHandlerConfigurationParametersJsonAdapter.java | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'reception') diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java b/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java index ca15bfb3..8ad293c3 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Copyright (C) 2019 Nordix Foundation. - * 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. @@ -52,7 +52,7 @@ public abstract class AbstractReceptionHandler implements ReceptionHandler { */ @Override public void initialize(final String parameterGroupName) throws PluginInitializationException { - final ReceptionHandlerParameters receptionHandlerParameters = ParameterService.get(parameterGroupName); + final var receptionHandlerParameters = (ReceptionHandlerParameters) ParameterService.get(parameterGroupName); pluginHandler = new PluginHandler(receptionHandlerParameters.getPluginHandlerParameters().getName()); initializeReception(receptionHandlerParameters.getReceptionHandlerConfigurationName()); } diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java b/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java index 95767a42..c2ea8009 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.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. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -115,7 +115,7 @@ public class PluginHandler { try { final Class policyForwarderClass = (Class) Class.forName(forwarderParameters.getForwarderClassName()); - final PolicyForwarder policyForwarder = policyForwarderClass.getDeclaredConstructor().newInstance(); + final var policyForwarder = policyForwarderClass.getDeclaredConstructor().newInstance(); policyForwarder.configure(forwarderParameters.getForwarderConfigurationName()); policyForwarders.add(policyForwarder); } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderConfigurationParametersJsonAdapter.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderConfigurationParametersJsonAdapter.java index 64ffa135..aedf357e 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderConfigurationParametersJsonAdapter.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderConfigurationParametersJsonAdapter.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. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class PolicyDecoderConfigurationParametersJsonAdapter @Override public PolicyDecoderConfigurationParameterGroup deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) { - final JsonObject jsonObject = json.getAsJsonObject(); + final var jsonObject = json.getAsJsonObject(); final String policyDecoderParameterClassName = getParameterGroupClassName(jsonObject); final Class policyDecoderParameterClass = getParameterGroupClass(policyDecoderParameterClassName); @@ -55,7 +55,7 @@ public class PolicyDecoderConfigurationParametersJsonAdapter } 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/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParametersJsonAdapter.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParametersJsonAdapter.java index 6cdbf28b..bc2e0e0c 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParametersJsonAdapter.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParametersJsonAdapter.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. * ================================================================================ * 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 ReceptionHandlerConfigurationParametersJsonAdapter @Override public ReceptionHandlerConfigurationParameterGroup deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) { - final JsonObject jsonObject = json.getAsJsonObject(); + final var jsonObject = json.getAsJsonObject(); final String receptionHandlerParameterClassName = getParameterGroupClassName(jsonObject); final Class receptionHandlerParameterClass = getParameterGroupClass(receptionHandlerParameterClassName); @@ -54,7 +54,7 @@ public class ReceptionHandlerConfigurationParametersJsonAdapter } 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 \"" -- cgit 1.2.3-korg