From f2ecd3282507c418ee7da5cd22c6e7613975d480 Mon Sep 17 00:00:00 2001 From: "ning.xi" Date: Fri, 12 Jul 2019 08:02:09 +0000 Subject: fix sonar issues in restclient/restrequest Issue-ID: POLICY-1743 Change-Id: I2bd2224904e459d56f5802e8b5276823e7f5d454 Signed-off-by: ning.xi --- .../restrequestor/ApexRestRequestorConsumer.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src') diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java index f1024d0fc..82d16273f 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java @@ -27,16 +27,14 @@ import java.util.Arrays; import java.util.EnumMap; import java.util.List; import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.Optional; import java.util.Map.Entry; +import java.util.Optional; import java.util.Properties; +import java.util.Set; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @@ -254,15 +252,15 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { Set names = restConsumerProperties.getKeysFromUrl(); Set inputProperty = inputExecutionProperties.stringPropertyNames(); - names.stream().map(key -> Optional.of(key)).forEach(op -> { - op.filter(str -> inputProperty.contains(str)) + names.stream().map(Optional::of).forEach(op -> + op.filter(inputProperty::contains) .orElseThrow(() -> new ApexEventRuntimeException( - "key\"" + op.get() + "\"specified on url \"" + restConsumerProperties.getUrl() + - "\"not found in execution properties passed by the current policy")); - }); + "key\"" + op.get() + "\"specified on url \"" + restConsumerProperties.getUrl() + + "\"not found in execution properties passed by the current policy")) + ); untaggedUrl = names.stream().reduce(untaggedUrl, - (acc, str) -> acc.replace("{" + str + "}", (String) inputExecutionProperties.get(str))); + (acc, str) -> acc.replace("{" + str + "}", (String) inputExecutionProperties.get(str))); } // Set the time stamp of the REST request -- cgit 1.2.3-korg