From f4580fa8a931c84b36d59e2ef853d1fba3d5917e Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 27 Aug 2021 15:24:06 -0400 Subject: Fix sonars in apex-pdp #2 plugins-events thru plugins-persistence-jpa-eclipselink Fixed: - use "var" - disambiguate method parameter types - rename parameter Issue-ID: POLICY-3093 Change-Id: Ife5897015be495403e731754d5862b803a217c87 Signed-off-by: Jim Hahn --- .../policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java | 7 +++---- .../event/carrier/grpc/GrpcCarrierTechnologyParameters.java | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src') diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java index ce00210e8..fcb743df8 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. * Modifications Copyright (C) 2020-2021 Bell Canada. 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. @@ -24,13 +25,11 @@ package org.onap.policy.apex.plugins.event.carrier.grpc; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.util.JsonFormat; import java.util.Properties; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; -import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput.Builder; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; import org.onap.policy.apex.service.engine.event.ApexEventConsumer; import org.onap.policy.apex.service.engine.event.ApexEventException; @@ -100,7 +99,7 @@ public class ApexGrpcProducer extends ApexPluginsEventProducer implements CdsPro final Object event) { ExecutionServiceInput executionServiceInput; - Builder builder = ExecutionServiceInput.newBuilder(); + var builder = ExecutionServiceInput.newBuilder(); try { JsonFormat.parser().ignoringUnknownFields().merge((String) event, builder); executionServiceInput = builder.build(); @@ -109,7 +108,7 @@ public class ApexGrpcProducer extends ApexPluginsEventProducer implements CdsPro "Incoming Event cannot be converted to ExecutionServiceInput type for gRPC request." + e.getMessage()); } try { - CountDownLatch countDownLatch = client.sendRequest(executionServiceInput); + var countDownLatch = client.sendRequest(executionServiceInput); if (!countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS)) { cdsResponse.set(ExecutionServiceOutput.newBuilder().setStatus(Status.newBuilder() .setErrorMessage(CdsActorConstants.TIMED_OUT).setEventType(EventType.EVENT_COMPONENT_FAILURE)) diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.java index f13248ec5..79a28c6cf 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.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. @@ -84,7 +85,7 @@ public class GrpcCarrierTechnologyParameters extends CarrierTechnologyParameters * @throws ApexEventException exception thrown when invalid parameters are provided */ public void validateGrpcParameters(boolean isProducer) throws ApexEventException { - StringBuilder errorMessage = new StringBuilder(); + var errorMessage = new StringBuilder(); if (isProducer) { if (timeout < 1) { errorMessage.append("timeout should have a positive value.\n"); -- cgit 1.2.3-korg