Skip to content

Commit 5bd6278

Browse files
committed
Fix new sonar smells
1 parent b8e2dfe commit 5bd6278

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import org.springframework.integration.endpoint.AbstractEndpoint;
6363
import org.springframework.integration.expression.ExpressionUtils;
6464
import org.springframework.integration.expression.ValueExpression;
65-
import org.springframework.integration.support.DefaultMessageBuilderFactory;
6665
import org.springframework.integration.support.channel.ChannelResolverUtils;
6766
import org.springframework.integration.support.management.TrackableComponent;
6867
import org.springframework.integration.util.JavaUtils;
@@ -873,7 +872,7 @@ private GatewayMethodInboundMessageMapper createGatewayMessageMapper(Method meth
873872
headers, this.argsMapper, getMessageBuilderFactory());
874873
}
875874

876-
@Nullable
875+
@Nullable // NOSONAR - complexitty
877876
private Map<String, Object> headers(Method method, Map<String, Expression> headerExpressions) {
878877
Map<String, Object> headers = null;
879878
// We don't want to eagerly resolve the error channel here
@@ -896,25 +895,23 @@ private Map<String, Object> headers(Method method, Map<String, Expression> heade
896895
headers.put(MessageHeaders.REPLY_CHANNEL, IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME);
897896
}
898897

899-
if (getMessageBuilderFactory() instanceof DefaultMessageBuilderFactory) {
900-
Set<String> headerNames = new HashSet<>(headerExpressions.keySet());
898+
Set<String> headerNames = new HashSet<>(headerExpressions.keySet());
901899

902-
if (this.globalMethodMetadata != null) {
903-
headerNames.addAll(this.globalMethodMetadata.getHeaderExpressions().keySet());
904-
}
900+
if (this.globalMethodMetadata != null) {
901+
headerNames.addAll(this.globalMethodMetadata.getHeaderExpressions().keySet());
902+
}
905903

906-
List<MethodParameter> methodParameters = GatewayMethodInboundMessageMapper.getMethodParameterList(method);
904+
List<MethodParameter> methodParameters = GatewayMethodInboundMessageMapper.getMethodParameterList(method);
907905

908-
for (MethodParameter methodParameter : methodParameters) {
909-
Header header = methodParameter.getParameterAnnotation(Header.class);
910-
if (header != null) {
911-
String headerName = GatewayMethodInboundMessageMapper.determineHeaderName(header, methodParameter);
912-
headerNames.add(headerName);
913-
}
906+
for (MethodParameter methodParameter : methodParameters) {
907+
Header header = methodParameter.getParameterAnnotation(Header.class);
908+
if (header != null) {
909+
String headerName = GatewayMethodInboundMessageMapper.determineHeaderName(header, methodParameter);
910+
headerNames.add(headerName);
914911
}
915-
916-
validateHeaders(headerNames);
917912
}
913+
914+
validateHeaders(headerNames);
918915
return headers;
919916
}
920917

spring-integration-core/src/main/java/org/springframework/integration/util/IntegrationReactiveUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.springframework.integration.util;
1818

1919
import java.time.Duration;
20-
import java.util.function.Function;
2120

2221
import org.reactivestreams.Publisher;
2322

@@ -47,7 +46,7 @@ public final class IntegrationReactiveUtils {
4746

4847
/**
4948
* The subscriber context entry for {@link Flux#delayElements}
50-
* from the {@link Mono#repeatWhenEmpty(Function)}.
49+
* from the {@link Mono#repeatWhenEmpty(java.util.function.Function)}.
5150
*/
5251
public static final String DELAY_WHEN_EMPTY_KEY = "DELAY_WHEN_EMPTY_KEY";
5352

spring-integration-test/src/main/java/org/springframework/integration/test/context/MockIntegrationContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ public void substituteMessageHandlerFor(String consumerEndpointId, MessageHandle
162162
substituteMessageHandlerFor(consumerEndpointId, mockMessageHandler, true);
163163
}
164164

165-
public void substituteMessageHandlerFor(String consumerEndpointId, MessageHandler mockMessageHandler,
166-
boolean autoStartup) {
165+
public void substituteMessageHandlerFor(String consumerEndpointId, // NOSONAR - complexity
166+
MessageHandler mockMessageHandler, boolean autoStartup) {
167+
167168
Object endpoint = this.beanFactory.getBean(consumerEndpointId, IntegrationConsumer.class);
168169
if (autoStartup && endpoint instanceof Lifecycle) {
169170
((Lifecycle) endpoint).stop();

0 commit comments

Comments
 (0)