From 66c3eff2ba8663968fd6d744a69405bef5b8a383 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 29 Oct 2019 08:11:31 -0400 Subject: [PATCH] Fix new Sonar smells --- .../dsl/BaseIntegrationFlowDefinition.java | 13 +++++---- .../dsl/IntegrationFlowDefinition.java | 28 +++++++++---------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java index 9d02599603..789c72faa1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java @@ -470,11 +470,12 @@ public abstract class BaseIntegrationFlowDefinition B fluxTransform(Function>, ? extends Publisher> fluxFunction) { - if (!(getCurrentMessageChannel() instanceof FluxMessageChannel)) { - channel(new FluxMessageChannel()); + MessageChannel currentChannel = getCurrentMessageChannel(); + if (!(currentChannel instanceof FluxMessageChannel)) { + currentChannel = new FluxMessageChannel(); + channel(currentChannel); } - Publisher> upstream = (Publisher>) getCurrentMessageChannel(); + Publisher> upstream = (Publisher>) currentChannel; Flux> result = Transformers.transformWithFunction(upstream, fluxFunction); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java index 0e3ffacb26..2d9f9f266a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java @@ -25,11 +25,8 @@ import org.reactivestreams.Publisher; import org.springframework.expression.Expression; import org.springframework.integration.core.GenericSelector; -import org.springframework.integration.filter.MessageFilter; -import org.springframework.integration.filter.MethodInvokingSelector; import org.springframework.integration.handler.BridgeHandler; import org.springframework.integration.handler.GenericHandler; -import org.springframework.integration.handler.LambdaMessageProcessor; import org.springframework.integration.handler.LoggingHandler; import org.springframework.integration.handler.MessageTriggerAction; import org.springframework.integration.handler.ServiceActivatingHandler; @@ -46,7 +43,6 @@ import org.springframework.integration.support.MapBuilder; import org.springframework.integration.transformer.GenericTransformer; import org.springframework.integration.transformer.HeaderFilter; import org.springframework.integration.transformer.MessageTransformingHandler; -import org.springframework.integration.transformer.MethodInvokingTransformer; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHandler; @@ -80,8 +76,8 @@ public abstract class IntegrationFlowDefinition the source type - 'transform from'. * @param the target type - 'transform to'. * @return the current {@link IntegrationFlowDefinition}. - * @see MethodInvokingTransformer - * @see LambdaMessageProcessor + * @see org.springframework.integration.transformer.MethodInvokingTransformer + * @see org.springframework.integration.handler.LambdaMessageProcessor */ public B transform(GenericTransformer genericTransformer) { return transform(null, genericTransformer); @@ -100,8 +96,8 @@ public abstract class IntegrationFlowDefinition the source type - 'transform from'. * @param the target type - 'transform to'. * @return the current {@link IntegrationFlowDefinition}. - * @see MethodInvokingTransformer - * @see LambdaMessageProcessor + * @see org.springframework.integration.transformer.MethodInvokingTransformer + * @see org.springframework.integration.handler.LambdaMessageProcessor * @see GenericEndpointSpec */ public B transform(GenericTransformer genericTransformer, @@ -111,7 +107,8 @@ public abstract class IntegrationFlowDefinition @@ -130,7 +127,8 @@ public abstract class IntegrationFlowDefinition the payload type to expect. * @return the current {@link IntegrationFlowDefinition}. - * @see LambdaMessageProcessor + * @see org.springframework.integration.handler.LambdaMessageProcessor */ public

B handle(GenericHandler

handler) { return handle(null, handler); @@ -189,7 +187,7 @@ public abstract class IntegrationFlowDefinition the payload type to expect. * @return the current {@link IntegrationFlowDefinition}. - * @see LambdaMessageProcessor + * @see org.springframework.integration.handler.LambdaMessageProcessor * @see GenericEndpointSpec */ public

B handle(GenericHandler

handler, @@ -218,7 +216,7 @@ public abstract class IntegrationFlowDefinition the payload type. * @return the current {@link IntegrationFlowDefinition}. - * @see LambdaMessageProcessor + * @see org.springframework.integration.handler.LambdaMessageProcessor * @see SplitterEndpointSpec */ public

B split(Function splitter, @@ -825,8 +823,8 @@ public abstract class IntegrationFlowDefinition, - ErrorMessageExceptionTypeRouter>> routerConfigurer) { // NOSONAR - byte code backward compatibility + public B routeByException(Consumer, // NOSONAR - byte code backward compatibility + ErrorMessageExceptionTypeRouter>> routerConfigurer) { return super.routeByException(routerConfigurer); }