diff --git a/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java b/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java index a91d13c83c..53b120ab7a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java @@ -264,18 +264,25 @@ public abstract class AbstractMappingMessageRouter extends AbstractMessageRouter mapped = true; } if (channelName != null) { - if (this.prefix != null) { - channelName = this.prefix + channelName; - } - if (this.suffix != null) { - channelName = channelName + this.suffix; - } - MessageChannel channel = resolveChannelForName(channelName, message); - if (channel != null) { - channels.add(channel); - if (!mapped && this.dynamicChannels.get(channelName) == null) { - this.dynamicChannels.put(channelName, channel); - } + addChannel(channels, message, channelName, mapped); + } + } + + private void addChannel(Collection channels, Message message, String channelNameArg, + boolean mapped) { + + String channelName = channelNameArg; + if (this.prefix != null) { + channelName = this.prefix + channelName; + } + if (this.suffix != null) { + channelName = channelName + this.suffix; + } + MessageChannel channel = resolveChannelForName(channelName, message); + if (channel != null) { + channels.add(channel); + if (!mapped && this.dynamicChannels.get(channelName) == null) { + this.dynamicChannels.put(channelName, channel); } } } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/DirectoryCreatedEvent.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/DirectoryCreatedEvent.java index 367bc7d3ab..efaedda08b 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/DirectoryCreatedEvent.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/DirectoryCreatedEvent.java @@ -19,6 +19,8 @@ package org.springframework.integration.sftp.server; import java.nio.file.Path; import java.util.Map; +import org.springframework.lang.Nullable; + /** * An event emitted when a directory is created. * @@ -30,7 +32,7 @@ public class DirectoryCreatedEvent extends ApacheMinaSftpEvent { private static final long serialVersionUID = 1L; - private final Path path; + private transient Path path; private final Map attrs; @@ -40,6 +42,7 @@ public class DirectoryCreatedEvent extends ApacheMinaSftpEvent { this.attrs = attrs; } + @Nullable public Path getPath() { return this.path; } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/FileWrittenEvent.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/FileWrittenEvent.java index 394ad1c2e9..4b0c9efe4c 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/FileWrittenEvent.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/FileWrittenEvent.java @@ -33,7 +33,7 @@ public class FileWrittenEvent extends ApacheMinaSftpEvent { private final String remoteHandle; - private final Path file; + private transient Path file; private final int dataLen; @@ -48,6 +48,7 @@ public class FileWrittenEvent extends ApacheMinaSftpEvent { return this.remoteHandle; } + @Nullable public Path getFile() { return this.file; } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathMovedEvent.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathMovedEvent.java index 210b2cc297..56127216dc 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathMovedEvent.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathMovedEvent.java @@ -31,9 +31,9 @@ public class PathMovedEvent extends ApacheMinaSftpEvent { private static final long serialVersionUID = 1L; - private final Path srcPath; + private transient Path srcPath; - private final Path dstPath; + private transient Path dstPath; public PathMovedEvent(Object source, Path srcPath, Path dstPath, @Nullable Throwable thrown) { super(source, thrown); @@ -41,10 +41,12 @@ public class PathMovedEvent extends ApacheMinaSftpEvent { this.dstPath = dstPath; } + @Nullable public Path getSrcPath() { return this.srcPath; } + @Nullable public Path getDstPath() { return this.dstPath; } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathRemovedEvent.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathRemovedEvent.java index ee33e7bf7b..6a640c70bd 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathRemovedEvent.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathRemovedEvent.java @@ -31,7 +31,7 @@ public class PathRemovedEvent extends ApacheMinaSftpEvent { private static final long serialVersionUID = 1L; - private final Path path; + private transient Path path; private final boolean isDirectory; @@ -41,6 +41,7 @@ public class PathRemovedEvent extends ApacheMinaSftpEvent { this.isDirectory = isDirectory; } + @Nullable public Path getPath() { return this.path; }