diff options
author | Jim Hahn <jrh3@att.com> | 2021-08-27 15:24:06 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-08-27 16:08:00 -0400 |
commit | f4580fa8a931c84b36d59e2ef853d1fba3d5917e (patch) | |
tree | 0c6a047fadfa26898af614460ac8699f2aa4a4ab /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main | |
parent | 9d8894092ced589c0bdc5b9e85ee1bf1c85d3e36 (diff) |
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 <jrh3@att.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main')
2 files changed, 4 insertions, 6 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java index db14006eb..956345cd4 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java @@ -24,11 +24,9 @@ package org.onap.policy.apex.plugins.event.carrier.restclient; import java.util.Properties; -import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.core.Response; import lombok.AccessLevel; import lombok.Setter; import org.apache.commons.lang3.StringUtils; @@ -148,11 +146,11 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer { @Override public void run() { try { - final Response response = client.target(restConsumerProperties.getUrl()).request("application/json") + final var response = client.target(restConsumerProperties.getUrl()).request("application/json") .headers(restConsumerProperties.getHttpHeadersAsMultivaluedMap()).get(); // Match the return code - Matcher isPass = httpCodeFilterPattern.matcher(String.valueOf(response.getStatus())); + var isPass = httpCodeFilterPattern.matcher(String.valueOf(response.getStatus())); // Check that status code if (!isPass.matches()) { @@ -164,7 +162,7 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer { } // Get the event we received - final String eventJsonString = response.readEntity(String.class); + final var eventJsonString = response.readEntity(String.class); // Check there is content if (StringUtils.isBlank(eventJsonString)) { diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java index cb6b55371..035bd6524 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java @@ -124,7 +124,7 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, untaggedUrl, event.toString()); // Send the event as a REST request - final Response response = sendEventAsRestRequest(untaggedUrl, (String) event); + final var response = sendEventAsRestRequest(untaggedUrl, (String) event); NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, untaggedUrl, response.readEntity(String.class)); |