Fix new Sonar smells
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.springframework.integration.graph;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.micrometer.core.instrument.Counter;
|
||||
@@ -126,20 +127,25 @@ public class MicrometerNodeEnhancer {
|
||||
private <T extends IntegrationNode> Timer observationTimer(T node, String type, boolean success) {
|
||||
Search timerSearch =
|
||||
switch (type) {
|
||||
case "channel" -> this.registry.find(DefaultMessageSenderObservationConvention.INSTANCE.getName())
|
||||
case "channel" -> this.registry.find(
|
||||
Objects.requireNonNull(
|
||||
DefaultMessageSenderObservationConvention.INSTANCE.getName()))
|
||||
.tag(IntegrationObservation.ProducerTags.COMPONENT_TYPE.asString(), "producer");
|
||||
case "handler" -> this.registry.find(DefaultMessageReceiverObservationConvention.INSTANCE.getName())
|
||||
case "handler" -> this.registry.find(
|
||||
Objects.requireNonNull(
|
||||
DefaultMessageReceiverObservationConvention.INSTANCE.getName()))
|
||||
.tag(IntegrationObservation.HandlerTags.COMPONENT_TYPE.asString(), "handler");
|
||||
case "gateway" ->
|
||||
this.registry.find(DefaultMessageRequestReplyReceiverObservationConvention.INSTANCE.getName())
|
||||
.tag(IntegrationObservation.GatewayTags.COMPONENT_TYPE.asString(), "gateway");
|
||||
case "gateway" -> this.registry.find(
|
||||
Objects.requireNonNull(
|
||||
DefaultMessageRequestReplyReceiverObservationConvention.INSTANCE.getName()))
|
||||
.tag(IntegrationObservation.GatewayTags.COMPONENT_TYPE.asString(), "gateway");
|
||||
default -> null;
|
||||
};
|
||||
|
||||
if (timerSearch != null) {
|
||||
return timerSearch
|
||||
.tag(IntegrationObservation.HandlerTags.COMPONENT_NAME.asString(), node.getName())
|
||||
.tag("error", value -> success == "none".equals(value))
|
||||
.tag("error", (value) -> success == "none".equals(value))
|
||||
.timer();
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,8 @@ import org.springframework.web.util.DefaultUriBuilderFactory;
|
||||
*/
|
||||
public class WebFluxRequestExecutingMessageHandler extends AbstractHttpRequestExecutingMessageHandler {
|
||||
|
||||
private static final String UNCHECKED = "unchecked";
|
||||
|
||||
private final WebClient webClient;
|
||||
|
||||
private final boolean webClientExplicitlySet;
|
||||
@@ -271,7 +273,7 @@ public class WebFluxRequestExecutingMessageHandler extends AbstractHttpRequestEx
|
||||
return requestSpec;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings(UNCHECKED)
|
||||
private Map<String, Object> evaluateAttributeVariables(Message<?> requestMessage) {
|
||||
return this.attributeVariablesExpression.getValue(this.evaluationContext, requestMessage, Map.class);
|
||||
}
|
||||
@@ -285,7 +287,7 @@ public class WebFluxRequestExecutingMessageHandler extends AbstractHttpRequestEx
|
||||
return null;
|
||||
}
|
||||
|
||||
BodyInserter<?, ? super ClientHttpRequest> inserter = null;
|
||||
BodyInserter<?, ? super ClientHttpRequest> inserter;
|
||||
if (requestBody instanceof Resource) {
|
||||
inserter = BodyInserters.fromResource((Resource) requestBody);
|
||||
}
|
||||
@@ -302,7 +304,7 @@ public class WebFluxRequestExecutingMessageHandler extends AbstractHttpRequestEx
|
||||
return inserter;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings(UNCHECKED)
|
||||
private <T, P extends Publisher<T>> BodyInserter<P, ? super ClientHttpRequest> buildBodyInserterForPublisher(
|
||||
Message<?> requestMessage, P publisher) {
|
||||
|
||||
@@ -322,7 +324,7 @@ public class WebFluxRequestExecutingMessageHandler extends AbstractHttpRequestEx
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings(UNCHECKED)
|
||||
private static BodyInserters.FormInserter<?> buildBodyInserterForMultiValueMap(
|
||||
MultiValueMap<?, ?> requestBody, MediaType contentType) {
|
||||
|
||||
@@ -345,7 +347,7 @@ public class WebFluxRequestExecutingMessageHandler extends AbstractHttpRequestEx
|
||||
.toEntityFlux(createBodyExtractor(expectedResponseType));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({UNCHECKED, "rawtypes"})
|
||||
private BodyExtractor<Flux<Object>, ? super ClientHttpResponse> createBodyExtractor(Object expectedResponseType) {
|
||||
if (expectedResponseType != null) {
|
||||
if (this.replyPayloadToFlux) {
|
||||
|
||||
Reference in New Issue
Block a user