From c7042151df72cbfafb73b0bcce9282e88203ef1f Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 8 Jun 2016 21:49:55 -0400 Subject: [PATCH] INT-4049:Fix FileSplitter for Message item JIRA: https://jira.spring.io/browse/INT-4049 Since the `FileSplitter` can now return `Message` as item for markers, we should ensure the original headers copying, e.g. `file_remoteSession` Also change `FtpServerOutboundTests-context.xml` to check that new `file_marker` header works well --- .../integration/splitter/AbstractMessageSplitter.java | 8 ++++---- .../ftp/outbound/FtpServerOutboundTests-context.xml | 2 +- .../sftp/outbound/SftpServerOutboundTests-context.xml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/splitter/AbstractMessageSplitter.java b/spring-integration-core/src/main/java/org/springframework/integration/splitter/AbstractMessageSplitter.java index 2d8dc1f302..6d396b489a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/splitter/AbstractMessageSplitter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/splitter/AbstractMessageSplitter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 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. @@ -112,12 +112,12 @@ public abstract class AbstractMessageSplitter extends AbstractReplyProducingMess Object correlationId, int sequenceNumber, int sequenceSize) { AbstractIntegrationMessageBuilder builder; if (item instanceof Message) { - builder = this.getMessageBuilderFactory().fromMessage((Message) item); + builder = getMessageBuilderFactory().fromMessage((Message) item); } else { - builder = this.getMessageBuilderFactory().withPayload(item); - builder.copyHeaders(headers); + builder = getMessageBuilderFactory().withPayload(item); } + builder.copyHeaders(headers); if (this.applySequence) { builder.pushSequenceDetails(correlationId, sequenceNumber, sequenceSize); } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml index 2d2925e481..1174cd05b4 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/outbound/FtpServerOutboundTests-context.xml @@ -124,7 +124,7 @@ + expression="'END'.equals(headers['file_marker']) ? headers['file_remoteSession'].close() : null"/> diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml index 200c807b1c..5796220c94 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/outbound/SftpServerOutboundTests-context.xml @@ -151,7 +151,7 @@ + expression="headers['file_marker']?.equals('END') ? headers['file_remoteSession'].close() : null"/>