diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java index 7d23995b95..f331382473 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -407,16 +407,17 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport * is interrupted. If the specified timeout is 0, the method will return * immediately. If less than zero, it will block indefinitely (see * {@link #send(Message)}). - * @param message the Message to send + * @param messageArg the Message to send * @param timeout the timeout in milliseconds * @return true if the message is sent successfully, * false if the message cannot be sent within the allotted * time or the sending thread is interrupted. */ @Override - public boolean send(Message message, long timeout) { - Assert.notNull(message, "message must not be null"); - Assert.notNull(message.getPayload(), "message payload must not be null"); + public boolean send(Message messageArg, long timeout) { + Assert.notNull(messageArg, "message must not be null"); + Assert.notNull(messageArg.getPayload(), "message payload must not be null"); + Message message = messageArg; if (this.shouldTrack) { message = MessageHistory.write(message, this, this.getMessageBuilderFactory()); } @@ -596,8 +597,10 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport } @Nullable - public Message preSend(Message message, MessageChannel channel, + public Message preSend(Message messageArg, MessageChannel channel, Deque interceptorStack) { + + Message message = messageArg; if (this.size > 0) { for (ChannelInterceptor interceptor : this.interceptors) { Message previous = message; @@ -652,7 +655,8 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport } @Nullable - public Message postReceive(Message message, MessageChannel channel) { + public Message postReceive(Message messageArg, MessageChannel channel) { + Message message = messageArg; if (this.size > 0) { for (ChannelInterceptor interceptor : this.interceptors) { message = interceptor.postReceive(message, channel); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java index ba05858660..6563960cdb 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -124,9 +124,11 @@ public class PriorityChannel extends QueueChannel { return false; } if (!this.useMessageStore) { - message = new MessageWrapper(message); + return super.doSend(new MessageWrapper(message), 0); + } + else { + return super.doSend(message, 0); } - return super.doSend(message, 0); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java index b983191328..03871dd9a0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/InboundChannelAdapterAnnotationPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,8 +100,10 @@ public class InboundChannelAdapterAnnotationPostProcessor extends return adapter; } - private MessageSource createMessageSource(Object bean, String beanName, Method method) { + private MessageSource createMessageSource(Object beanArg, String beanName, Method methodArg) { MessageSource messageSource = null; + Object bean = beanArg; + Method method = methodArg; if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) { Object target = this.resolveTargetBeanFromMethodWithBeanAnnotation(method); Class targetClass = target.getClass(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelParser.java index b318e1865f..db6fc1bc10 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractChannelParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ import org.springframework.util.xml.DomUtils; * @author Mark Fisher * @author Dave Syer * @author Artem Bilan + * @author Gary Russell */ public abstract class AbstractChannelParser extends AbstractBeanDefinitionParser { @@ -86,10 +87,13 @@ public abstract class AbstractChannelParser extends AbstractBeanDefinitionParser @Override protected void registerBeanDefinition(BeanDefinitionHolder definition, BeanDefinitionRegistry registry) { String scope = definition.getBeanDefinition().getScope(); - if (!AbstractBeanDefinition.SCOPE_DEFAULT.equals(scope) && !AbstractBeanDefinition.SCOPE_SINGLETON.equals(scope) && !AbstractBeanDefinition.SCOPE_PROTOTYPE.equals(scope)) { - definition = ScopedProxyUtils.createScopedProxy(definition, registry, false); + if (!AbstractBeanDefinition.SCOPE_DEFAULT.equals(scope) && !AbstractBeanDefinition.SCOPE_SINGLETON.equals(scope) + && !AbstractBeanDefinition.SCOPE_PROTOTYPE.equals(scope)) { + super.registerBeanDefinition(ScopedProxyUtils.createScopedProxy(definition, registry, false), registry); + } + else { + super.registerBeanDefinition(definition, registry); } - super.registerBeanDefinition(definition, registry); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java index d7625eb6f2..5011419ee2 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/HeaderEnricherParserSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ import org.springframework.integration.transformer.support.ExpressionEvaluatingH import org.springframework.integration.transformer.support.MessageProcessingHeaderValueMessageProcessor; import org.springframework.integration.transformer.support.RoutingSlipHeaderValueMessageProcessor; import org.springframework.integration.transformer.support.StaticHeaderValueMessageProcessor; +import org.springframework.lang.Nullable; import org.springframework.util.StringUtils; import org.springframework.util.xml.DomUtils; @@ -148,11 +149,13 @@ public abstract class HeaderEnricherParserSupport extends AbstractTransformerPar } private void addHeader(Element element, ManagedMap headers, ParserContext parserContext, - String headerName, Element headerElement, String headerType, String expression, String overwrite) { + String headerName, Element headerElement, String headerType, @Nullable String expressionArg, + String overwrite) { String value = headerElement.getAttribute("value"); String ref = headerElement.getAttribute(REF_ATTRIBUTE); String method = headerElement.getAttribute(METHOD_ATTRIBUTE); + String expression = expressionArg; if (expression == null) { expression = headerElement.getAttribute(EXPRESSION_ATTRIBUTE); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java index 5c60e64475..6d35d9ffbd 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,7 @@ import org.springframework.integration.config.FixedSubscriberChannelBeanFactoryP import org.springframework.integration.config.IntegrationConfigUtils; import org.springframework.integration.context.IntegrationContextUtils; import org.springframework.integration.transaction.TransactionHandleMessageAdvice; +import org.springframework.lang.Nullable; import org.springframework.transaction.interceptor.DefaultTransactionAttribute; import org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource; import org.springframework.transaction.interceptor.TransactionInterceptor; @@ -356,12 +357,14 @@ public abstract class IntegrationNamespaceUtils { * @param rootBuilder The root builder. * @param parserContext The parser context. * @param headerMapperBuilder The header mapper builder. - * @param replyHeaderValue The reply header value. + * @param replyHeaderValueArg The reply header value. */ public static void configureHeaderMapper(Element element, BeanDefinitionBuilder rootBuilder, - ParserContext parserContext, BeanDefinitionBuilder headerMapperBuilder, String replyHeaderValue) { + ParserContext parserContext, BeanDefinitionBuilder headerMapperBuilder, + @Nullable String replyHeaderValueArg) { String defaultMappedReplyHeadersAttributeName = "mapped-reply-headers"; + String replyHeaderValue = replyHeaderValueArg; if (!StringUtils.hasText(replyHeaderValue)) { replyHeaderValue = defaultMappedReplyHeadersAttributeName; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryException.java b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryException.java index 8756719431..cfb2c8bba9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryException.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/AggregateMessageDeliveryException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.springframework.util.StringUtils; * * @author Mark Fisher * @author Artem Bilan + * @author Gary Russell * * @since 1.0.3 */ @@ -67,12 +68,14 @@ public class AggregateMessageDeliveryException extends MessageDeliveryException private String appendPeriodIfNecessary(String baseMessage) { if (!StringUtils.hasText(baseMessage)) { - baseMessage = ""; + return ""; } else if (!baseMessage.endsWith(".")) { - baseMessage = baseMessage + "."; + return baseMessage + "."; + } + else { + return baseMessage; } - return baseMessage; } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java index adac682722..d819046b25 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018 the original author or authors. + * Copyright 2016-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -221,13 +221,16 @@ public final class IntegrationFlows { * @see SourcePollingChannelAdapterSpec */ public static IntegrationFlowBuilder from(MessageSource messageSource, - Consumer endpointConfigurer) { + @Nullable Consumer endpointConfigurer) { + return from(messageSource, endpointConfigurer, null); } private static IntegrationFlowBuilder from(MessageSource messageSource, - Consumer endpointConfigurer, - IntegrationFlowBuilder integrationFlowBuilder) { + @Nullable Consumer endpointConfigurer, + @Nullable IntegrationFlowBuilder integrationFlowBuilderArg) { + + IntegrationFlowBuilder integrationFlowBuilder = integrationFlowBuilderArg; SourcePollingChannelAdapterSpec spec = new SourcePollingChannelAdapterSpec(messageSource); if (endpointConfigurer != null) { endpointConfigurer.accept(spec); @@ -262,7 +265,9 @@ public final class IntegrationFlows { } private static IntegrationFlowBuilder from(MessageProducerSupport messageProducer, - IntegrationFlowBuilder integrationFlowBuilder) { + @Nullable IntegrationFlowBuilder integrationFlowBuilderArg) { + + IntegrationFlowBuilder integrationFlowBuilder = integrationFlowBuilderArg; MessageChannel outputChannel = messageProducer.getOutputChannel(); if (outputChannel == null) { outputChannel = new DirectChannel(); @@ -354,8 +359,9 @@ public final class IntegrationFlows { } private static IntegrationFlowBuilder from(MessagingGatewaySupport inboundGateway, - IntegrationFlowBuilder integrationFlowBuilder) { + @Nullable IntegrationFlowBuilder integrationFlowBuilderArg) { + IntegrationFlowBuilder integrationFlowBuilder = integrationFlowBuilderArg; MessageChannel outputChannel = inboundGateway.getRequestChannel(); if (outputChannel == null) { outputChannel = new DirectChannel(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java index 97234a5fc0..312ba080a6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018 the original author or authors. + * Copyright 2016-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.support.context.NamedComponent; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -124,7 +125,8 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont } @SuppressWarnings("unchecked") - private Object registerBean(Object bean, String beanName, String parentName) { + private Object registerBean(Object bean, @Nullable String beanNameArg, String parentName) { + String beanName = beanNameArg; if (beanName == null) { beanName = generateBeanName(bean, parentName); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java index d920a31c14..b00d54ba96 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -192,7 +192,8 @@ public abstract class MessageProducerSupport extends AbstractEndpoint implements protected void doStop() { } - protected void sendMessage(Message message) { + protected void sendMessage(Message messageArg) { + Message message = messageArg; if (message == null) { throw new MessagingException("cannot send a null message"); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java index dc7fcbccb8..278dea6502 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -228,7 +228,8 @@ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint } @Override - protected void handleMessage(Message message) { + protected void handleMessage(Message messageArg) { + Message message = messageArg; if (this.shouldTrack) { message = MessageHistory.write(message, this, getMessageBuilderFactory()); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java b/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java index 5043169e7c..496ad4be79 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -408,9 +408,10 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc * The holder can be null if not cached before, or a timed-out cache entry * (potentially getting re-validated against the current last-modified timestamp). * @param filename the bundle filename (basename + Locale) - * @param propHolder the current PropertiesHolder for the bundle + * @param propHolderArg the current PropertiesHolder for the bundle */ - private PropertiesHolder refreshProperties(String filename, PropertiesHolder propHolder) { + private PropertiesHolder refreshProperties(String filename, @Nullable PropertiesHolder propHolderArg) { + PropertiesHolder propHolder = propHolderArg; long refreshTimestamp = (this.cacheMillis < 0) ? -1 : System.currentTimeMillis(); Resource resource = this.resourceLoader.getResource(filename + PROPERTIES_SUFFIX); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java index 8b793821cb..b52595f52f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -232,10 +232,9 @@ public abstract class MessagingGatewaySupport extends AbstractEndpoint * from any object passed in a send or sendAndReceive operation. * @param requestMapper The request mapper. */ - public void setRequestMapper(InboundMessageMapper requestMapper) { - requestMapper = (requestMapper != null) ? requestMapper : new DefaultRequestMapper(); - this.requestMapper = requestMapper; - this.messageConverter.setInboundMessageMapper(requestMapper); + public void setRequestMapper(@Nullable InboundMessageMapper requestMapper) { + this.requestMapper = (requestMapper != null) ? requestMapper : new DefaultRequestMapper(); + this.messageConverter.setInboundMessageMapper(this.requestMapper); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java index 78233062f1..43fdff213c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -139,7 +139,8 @@ public abstract class AbstractMessageHandler extends IntegrationObjectSupport } @Override - public void handleMessage(Message message) { + public void handleMessage(Message messageArg) { + Message message = messageArg; Assert.notNull(message, "Message must not be null"); Assert.notNull(message.getPayload(), "Message payload must not be null"); //NOSONAR - false positive if (this.loggingEnabled && this.logger.isDebugEnabled()) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java index 36889cb71d..3e99d5a364 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2018 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import org.springframework.integration.core.MessageProducer; import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.routingslip.RoutingSlipRouteStrategy; import org.springframework.integration.support.AbstractIntegrationMessageBuilder; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHandlingException; @@ -205,12 +206,8 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan @Override public MessageChannel getOutputChannel() { if (this.outputChannelName != null) { - synchronized (this) { - if (this.outputChannelName != null) { - this.outputChannel = getChannelResolver().resolveDestination(this.outputChannelName); - this.outputChannelName = null; - } - } + this.outputChannel = getChannelResolver().resolveDestination(this.outputChannelName); + this.outputChannelName = null; } return this.outputChannel; } @@ -235,9 +232,10 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan return false; } - protected void produceOutput(Object reply, final Message requestMessage) { + protected void produceOutput(Object replyArg, final Message requestMessage) { final MessageHeaders requestHeaders = requestMessage.getHeaders(); + Object reply = replyArg; Object replyChannel = null; if (getOutputChannel() == null) { Map routingSlipHeader = requestHeaders.get(IntegrationMessageHeaderAccessor.ROUTING_SLIP, Map.class); @@ -252,20 +250,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan AtomicInteger routingSlipIndex = new AtomicInteger((Integer) value); replyChannel = getOutputChannelFromRoutingSlip(reply, requestMessage, routingSlip, routingSlipIndex); if (replyChannel != null) { - //TODO Migrate to the SF MessageBuilder - AbstractIntegrationMessageBuilder builder = null; - if (reply instanceof Message) { - builder = this.getMessageBuilderFactory().fromMessage((Message) reply); - } - else if (reply instanceof AbstractIntegrationMessageBuilder) { - builder = (AbstractIntegrationMessageBuilder) reply; - } - else { - builder = this.getMessageBuilderFactory().withPayload(reply); - } - builder.setHeader(IntegrationMessageHeaderAccessor.ROUTING_SLIP, - Collections.singletonMap(routingSlip, routingSlipIndex.get())); - reply = builder; + reply = addRoutingSlipHeader(reply, routingSlip, routingSlipIndex); } } @@ -276,52 +261,16 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan } } } + doProduceOutput(requestMessage, requestHeaders, reply, replyChannel); + } + + private void doProduceOutput(final Message requestMessage, final MessageHeaders requestHeaders, Object reply, + Object replyChannel) { if (this.async && (reply instanceof ListenableFuture || reply instanceof Publisher)) { if (reply instanceof ListenableFuture || !(getOutputChannel() instanceof ReactiveStreamsSubscribableChannel)) { - ListenableFuture future; - if (reply instanceof ListenableFuture) { - future = (ListenableFuture) reply; - } - else { - SettableListenableFuture settableListenableFuture = new SettableListenableFuture<>(); - - Mono.from((Publisher) reply) - .subscribe(settableListenableFuture::set, settableListenableFuture::setException); - - future = settableListenableFuture; - } - - Object theReplyChannel = replyChannel; - future.addCallback(new ListenableFutureCallback() { - - @Override - public void onSuccess(Object result) { - Message replyMessage = null; - try { - replyMessage = createOutputMessage(result, requestHeaders); - sendOutput(replyMessage, theReplyChannel, false); - } - catch (Exception e) { - Exception exceptionToLogAndSend = e; - if (!(e instanceof MessagingException)) { - exceptionToLogAndSend = new MessageHandlingException(requestMessage, e); - if (replyMessage != null) { - exceptionToLogAndSend = new MessagingException(replyMessage, exceptionToLogAndSend); - } - } - logger.error("Failed to send async reply: " + result.toString(), exceptionToLogAndSend); - onFailure(exceptionToLogAndSend); - } - } - - @Override - public void onFailure(Throwable ex) { - sendErrorMessage(requestMessage, ex); - } - - }); + asyncNonReactiveReply(requestMessage, requestHeaders, reply, replyChannel); } else { ((ReactiveStreamsSubscribableChannel) getOutputChannel()) @@ -335,6 +284,71 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan } } + private AbstractIntegrationMessageBuilder addRoutingSlipHeader(Object reply, List routingSlip, + AtomicInteger routingSlipIndex) { + + //TODO Migrate to the SF MessageBuilder + AbstractIntegrationMessageBuilder builder = null; + if (reply instanceof Message) { + builder = this.getMessageBuilderFactory().fromMessage((Message) reply); + } + else if (reply instanceof AbstractIntegrationMessageBuilder) { + builder = (AbstractIntegrationMessageBuilder) reply; + } + else { + builder = this.getMessageBuilderFactory().withPayload(reply); + } + builder.setHeader(IntegrationMessageHeaderAccessor.ROUTING_SLIP, + Collections.singletonMap(routingSlip, routingSlipIndex.get())); + return builder; + } + + private void asyncNonReactiveReply(final Message requestMessage, final MessageHeaders requestHeaders, + Object reply, Object replyChannel) { + ListenableFuture future; + if (reply instanceof ListenableFuture) { + future = (ListenableFuture) reply; + } + else { + SettableListenableFuture settableListenableFuture = new SettableListenableFuture<>(); + + Mono.from((Publisher) reply) + .subscribe(settableListenableFuture::set, settableListenableFuture::setException); + + future = settableListenableFuture; + } + + Object theReplyChannel = replyChannel; + future.addCallback(new ListenableFutureCallback() { + + @Override + public void onSuccess(Object result) { + Message replyMessage = null; + try { + replyMessage = createOutputMessage(result, requestHeaders); + sendOutput(replyMessage, theReplyChannel, false); + } + catch (Exception e) { + Exception exceptionToLogAndSend = e; + if (!(e instanceof MessagingException)) { + exceptionToLogAndSend = new MessageHandlingException(requestMessage, e); + if (replyMessage != null) { + exceptionToLogAndSend = new MessagingException(replyMessage, exceptionToLogAndSend); + } + } + logger.error("Failed to send async reply: " + result.toString(), exceptionToLogAndSend); + onFailure(exceptionToLogAndSend); + } + } + + @Override + public void onFailure(Throwable ex) { + sendErrorMessage(requestMessage, ex); + } + + }); + } + private Object getOutputChannelFromRoutingSlip(Object reply, Message requestMessage, List routingSlip, AtomicInteger routingSlipIndex) { if (routingSlipIndex.get() >= routingSlip.size()) { @@ -397,11 +411,12 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan * 'outputChannel' is null. In that case, the 'replyChannel' value must not also be * null, and it must be an instance of either String or {@link MessageChannel}. * @param output the output object to send - * @param replyChannel the 'replyChannel' value from the original request + * @param replyChannelArg the 'replyChannel' value from the original request * @param useArgChannel - use the replyChannel argument (must not be null), not * the configured output channel. */ - protected void sendOutput(Object output, Object replyChannel, boolean useArgChannel) { + protected void sendOutput(Object output, @Nullable Object replyChannelArg, boolean useArgChannel) { + Object replyChannel = replyChannelArg; MessageChannel outputChannel = getOutputChannel(); if (!useArgChannel && outputChannel != null) { replyChannel = outputChannel; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistory.java b/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistory.java index 58d562e439..b6a6746f6d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistory.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,7 @@ import org.springframework.util.StringUtils; /** * @author Mark Fisher * @author Artem Bilan + * @author Gary Russell * @since 2.0 */ @SuppressWarnings("serial") @@ -74,8 +75,10 @@ public final class MessageHistory implements List, Serializable { } @SuppressWarnings("unchecked") - public static Message write(Message message, NamedComponent component, + public static Message write(Message messageArg, NamedComponent component, MessageBuilderFactory messageBuilderFactory) { + + Message message = messageArg; Assert.notNull(message, "Message must not be null"); Assert.notNull(component, "Component must not be null"); Properties metadata = extractMetadata(component); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java index a325001cbe..6135b6adc8 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToMapTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,7 +129,8 @@ public class ObjectToMapTransformer extends AbstractPayloadTransformer inputMap, Map resultMap) { + private void doFlatten(String propertyPrefixArg, Map inputMap, Map resultMap) { + String propertyPrefix = propertyPrefixArg; if (StringUtils.hasText(propertyPrefix)) { propertyPrefix = propertyPrefix + "."; } diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java index e222b0ae67..b25eecc9d1 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -536,11 +536,11 @@ public class RemoteFileTemplate implements RemoteFileOperations, Initializ } } - private void sendFileToRemoteDirectory(InputStream inputStream, String temporaryRemoteDirectory, - String remoteDirectory, String fileName, Session session, FileExistsMode mode) throws IOException { + private void sendFileToRemoteDirectory(InputStream inputStream, String temporaryRemoteDirectoryArg, + String remoteDirectoryArg, String fileName, Session session, FileExistsMode mode) throws IOException { - remoteDirectory = this.normalizeDirectoryPath(remoteDirectory); - temporaryRemoteDirectory = this.normalizeDirectoryPath(temporaryRemoteDirectory); + String remoteDirectory = normalizeDirectoryPath(remoteDirectoryArg); + String temporaryRemoteDirectory = normalizeDirectoryPath(temporaryRemoteDirectoryArg); String remoteFilePath = remoteDirectory + fileName; String tempRemoteFilePath = temporaryRemoteDirectory + fileName; @@ -598,12 +598,14 @@ public class RemoteFileTemplate implements RemoteFileOperations, Initializ private String normalizeDirectoryPath(String directoryPath) { if (!StringUtils.hasText(directoryPath)) { - directoryPath = ""; + return ""; } else if (!directoryPath.endsWith(this.remoteFileSeparator)) { - directoryPath += this.remoteFileSeparator; + return directoryPath + this.remoteFileSeparator; + } + else { + return directoryPath; } - return directoryPath; } private static final class StreamHolder { diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java index d167a665db..0c95e014dd 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -168,9 +168,10 @@ public class HttpRequestHandlingMessagingGateway extends HttpRequestHandlingEndp } @SuppressWarnings({ "unchecked", "rawtypes" }) - private void writeResponse(Object content, ServletServerHttpResponse response, List acceptTypes) + private void writeResponse(Object content, ServletServerHttpResponse response, List acceptTypesArg) throws IOException { + List acceptTypes = acceptTypesArg; if (CollectionUtils.isEmpty(acceptTypes)) { acceptTypes = Collections.singletonList(MediaType.ALL); } diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java index cdf88079f5..7c2d25cafe 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -123,7 +123,8 @@ public final class IntegrationRequestMappingHandlerMapping extends RequestMappin } @Override - protected HandlerExecutionChain getHandlerExecutionChain(Object handler, HttpServletRequest request) { + protected HandlerExecutionChain getHandlerExecutionChain(Object handlerArg, HttpServletRequest request) { + Object handler = handlerArg; if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; Object bean = handlerMethod.getBean(); diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java index 8d8b9af388..cb51276b39 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -572,7 +572,8 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport } } - protected TcpConnectionSupport wrapConnection(TcpConnectionSupport connection) throws Exception { + protected TcpConnectionSupport wrapConnection(TcpConnectionSupport connectionArg) throws Exception { + TcpConnectionSupport connection = connectionArg; try { if (this.interceptorFactoryChain == null) { return connection; diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java index 6c13afba51..8850be473a 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -361,14 +361,15 @@ public class TcpNioSSLConnection extends TcpNioConnection { * Handles SSL handshaking; when network data is needed from the peer, suspends * until that data is received. */ - private void doClientSideHandshake(ByteBuffer plainText, SSLEngineResult result) throws IOException { + private void doClientSideHandshake(ByteBuffer plainText, SSLEngineResult resultArg) throws IOException { + SSLEngineResult result = resultArg; TcpNioSSLConnection.this.semaphore.drainPermits(); HandshakeStatus status = TcpNioSSLConnection.this.sslEngine.getHandshakeStatus(); while (status != HandshakeStatus.FINISHED) { writeEncodedIfAny(); status = runTasksIfNeeded(result); if (status == HandshakeStatus.NEED_UNWRAP) { - status = waitForHandshakeData(result, status); + status = waitForHandshakeData(result); } if (status == HandshakeStatus.NEED_WRAP || status == HandshakeStatus.NOT_HANDSHAKING || @@ -395,8 +396,8 @@ public class TcpNioSSLConnection extends TcpNioConnection { /** * Suspend processing until data is received from the peer. */ - private HandshakeStatus waitForHandshakeData(SSLEngineResult result, - HandshakeStatus status) throws IOException { + private HandshakeStatus waitForHandshakeData(SSLEngineResult result) throws IOException { + try { logger.trace("Writer waiting for handshake"); if (!TcpNioSSLConnection.this.semaphore.tryAcquire(TcpNioSSLConnection.this.handshakeTimeout, @@ -412,13 +413,12 @@ public class TcpNioSSLConnection extends TcpNioConnection { } } logger.trace("Writer resuming handshake"); - status = runTasksIfNeeded(result); + return runTasksIfNeeded(result); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MessagingException("Interrupted during SSL Handshaking"); } - return status; } /** diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java index b037e3c3b0..b90e5ad223 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.springframework.integration.ip.util; import org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter; import org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory; import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory; +import org.springframework.lang.Nullable; /** * Convenience class providing methods for testing IP components. @@ -39,11 +40,13 @@ public final class TestingUtilities { * Wait for a server connection factory to actually start listening before * starting a test. Waits for up to 10 seconds by default. * @param serverConnectionFactory The server connection factory. - * @param delay How long to wait in milliseconds; default 10000 (10 seconds) if null. + * @param delayArg How long to wait in milliseconds; default 10000 (10 seconds) if null. * @throws IllegalStateException If the server does not start listening in time. */ - public static void waitListening(AbstractServerConnectionFactory serverConnectionFactory, Long delay) - throws IllegalStateException { + public static void waitListening(AbstractServerConnectionFactory serverConnectionFactory, @Nullable Long delayArg) + throws IllegalStateException { + + Long delay = delayArg; if (delay == null) { delay = 100L; } @@ -70,11 +73,13 @@ public final class TestingUtilities { * Wait for a server connection factory to actually start listening before * starting a test. Waits for up to 10 seconds by default. * @param adapter The server connection factory. - * @param delay How long to wait in milliseconds; default 10000 (10 seconds) if null. + * @param delayArg How long to wait in milliseconds; default 10000 (10 seconds) if null. * @throws IllegalStateException If the server does not start listening in time. */ - public static void waitListening(AbstractInternetProtocolReceivingChannelAdapter adapter, Long delay) - throws IllegalStateException { + public static void waitListening(AbstractInternetProtocolReceivingChannelAdapter adapter, @Nullable Long delayArg) + throws IllegalStateException { + + Long delay = delayArg; if (delay == null) { delay = 100L; } @@ -101,11 +106,13 @@ public final class TestingUtilities { * Wait for a server connection factory to stop listening. * Waits for up to 10 seconds by default. * @param serverConnectionFactory The server connection factory. - * @param delay How long to wait in milliseconds; default 10000 (10 seconds) if null. + * @param delayArg How long to wait in milliseconds; default 10000 (10 seconds) if null. * @throws IllegalStateException If the server doesn't stop listening in time. */ - public static void waitStopListening(AbstractServerConnectionFactory serverConnectionFactory, Long delay) + public static void waitStopListening(AbstractServerConnectionFactory serverConnectionFactory, @Nullable Long delayArg) throws IllegalStateException { + + Long delay = delayArg; if (delay == null) { delay = 100L; } diff --git a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java index cbedf034be..5496114ffd 100644 --- a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java +++ b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,10 +57,11 @@ public class RFC5424SyslogParser { this.retainOriginal = retainOriginal; } - public Map parse(String line, int octetCount, boolean shortRead) { + public Map parse(String lineArg, int octetCount, boolean shortRead) { // NOSONAR NCSS line count Map map = new LinkedHashMap(); + String line = lineArg; Reader r = new Reader(line); try { diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java index 039001b38b..d4127bfdb3 100644 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java +++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.support.GenericApplicationContext; import org.springframework.format.support.DefaultFormattingConversionService; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessagingException; @@ -150,7 +151,8 @@ public abstract class TestUtils { super(); } - public void registerChannel(String channelName, final MessageChannel channel) { + public void registerChannel(@Nullable String channelNameArg, final MessageChannel channel) { + String channelName = channelNameArg; String componentName = getComponentNameIfNamed(channel); if (componentName != null) { if (channelName == null) { diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/IntegrationWebSocketContainer.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/IntegrationWebSocketContainer.java index 08e85afe40..c84e35e529 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/IntegrationWebSocketContainer.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/IntegrationWebSocketContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,6 +51,7 @@ import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorato * have a precedent. * * @author Artem Bilan + * @author Gary Russell * @since 4.1 * @see org.springframework.integration.websocket.inbound.WebSocketInboundChannelAdapter * @see org.springframework.integration.websocket.outbound.WebSocketOutboundMessageHandler @@ -158,8 +159,8 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean { } @Override - public void afterConnectionEstablished(WebSocketSession session) throws Exception { - session = new ConcurrentWebSocketSessionDecorator(session, + public void afterConnectionEstablished(WebSocketSession sessionToDecorate) throws Exception { // NOSONAR SF ifce + WebSocketSession session = new ConcurrentWebSocketSessionDecorator(sessionToDecorate, IntegrationWebSocketContainer.this.sendTimeLimit, IntegrationWebSocketContainer.this.sendBufferSizeLimit); diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/support/ClientStompEncoder.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/support/ClientStompEncoder.java index 53c1d9bdec..e8ed03cbee 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/support/ClientStompEncoder.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/support/ClientStompEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import org.springframework.messaging.simp.stomp.StompHeaderAccessor; * {@link org.springframework.web.socket.messaging.StompSubProtocolHandler}. * * @author Artem Bilan + * @author Gary Russell * * @since 4.3.13 */ @@ -40,9 +41,11 @@ public class ClientStompEncoder extends StompEncoder { if (StompCommand.MESSAGE.equals(headers.get("stompCommand"))) { StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor.create(StompCommand.SEND); stompHeaderAccessor.copyHeadersIfAbsent(headers); - headers = stompHeaderAccessor.getMessageHeaders(); + return super.encode(stompHeaderAccessor.getMessageHeaders(), payload); + } + else { + return super.encode(headers, payload); } - return super.encode(headers, payload); } } diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java index 7661e55659..9b3a93747b 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.integration.ws; import java.io.IOException; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.oxm.Marshaller; import org.springframework.oxm.Unmarshaller; @@ -109,9 +110,10 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb * Sets the provided Marshaller and Unmarshaller on this gateway's WebServiceTemplate. * Neither may be null. * @param marshaller The marshaller. - * @param unmarshaller The unmarshaller. + * @param unmarshallerArg The unmarshaller. */ - private void configureMarshallers(Marshaller marshaller, Unmarshaller unmarshaller) { + private void configureMarshallers(Marshaller marshaller, @Nullable Unmarshaller unmarshallerArg) { + Unmarshaller unmarshaller = unmarshallerArg; Assert.notNull(marshaller, "marshaller must not be null"); if (unmarshaller == null) { Assert.isInstanceOf(Unmarshaller.class, marshaller, diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java index 8c462831f6..67975e9d75 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,11 +85,12 @@ public class XmlValidatingMessageSelector implements MessageSelector { * If no 'schemaType' is provided it will default to {@link XmlValidatorFactory#SCHEMA_W3C_XML}; * * @param schema The schema. - * @param schemaType The schema type. + * @param schemaTypeArg The schema type. * * @throws IOException if the XmlValidatorFactory fails to create a validator */ - public XmlValidatingMessageSelector(Resource schema, SchemaType schemaType) throws IOException { + public XmlValidatingMessageSelector(Resource schema, SchemaType schemaTypeArg) throws IOException { + SchemaType schemaType = schemaTypeArg; Assert.notNull(schema, "You must provide XML schema location to perform validation"); if (schemaType == null) { schemaType = SchemaType.XML_SCHEMA;