INT-1717 null, empty, or whitespace-only remoteDirectories will now all be treated as empty string (with NO trailing file separator added)

This commit is contained in:
Mark Fisher
2010-12-23 13:04:36 -05:00
parent 9a661a2160
commit c4b0da2800

View File

@@ -33,6 +33,7 @@ import org.springframework.integration.handler.AbstractMessageHandler;
import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
import org.springframework.util.Assert;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
/**
* A {@link org.springframework.integration.core.MessageHandler} implementation that transfers files to a remote server.
@@ -160,7 +161,10 @@ public class FileTransferringMessageHandler extends AbstractMessageHandler {
throws FileNotFoundException, IOException {
FileInputStream fileInputStream = new FileInputStream(file);
if (!remoteDirectory.endsWith(remoteFileSeparator)) {
if (!StringUtils.hasText(remoteDirectory)) {
remoteDirectory = "";
}
else if (!remoteDirectory.endsWith(remoteFileSeparator)) {
remoteDirectory += remoteFileSeparator;
}
String remoteFilePath = remoteDirectory + fileName;