diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/gateway/SftpOutboundGateway.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/gateway/SftpOutboundGateway.java index f39473dfb5..63d4479ec4 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/gateway/SftpOutboundGateway.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/gateway/SftpOutboundGateway.java @@ -16,11 +16,11 @@ package org.springframework.integration.sftp.gateway; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.springframework.beans.DirectFieldAccessor; import org.springframework.integration.file.remote.AbstractFileInfo; import org.springframework.integration.file.remote.ClientCallbackWithoutResult; import org.springframework.integration.file.remote.MessageSessionCallback; @@ -30,6 +30,7 @@ import org.springframework.integration.file.remote.session.SessionFactory; import org.springframework.integration.sftp.session.SftpFileInfo; import org.springframework.integration.sftp.session.SftpRemoteFileTemplate; import org.springframework.integration.sftp.support.GeneralSftpException; +import org.springframework.util.ReflectionUtils; import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.ChannelSftp.LsEntry; @@ -44,6 +45,13 @@ import com.jcraft.jsch.SftpException; */ public class SftpOutboundGateway extends AbstractRemoteFileOutboundGateway { + private static final Method LS_ENTRY_SET_FILENAME_METHOD; + + static { + LS_ENTRY_SET_FILENAME_METHOD = ReflectionUtils.findMethod(LsEntry.class, "setFilename", String.class); + LS_ENTRY_SET_FILENAME_METHOD.setAccessible(true); + } + /** * Construct an instance using the provided session factory and callback for * performing operations on the session. @@ -62,7 +70,7 @@ public class SftpOutboundGateway extends AbstractRemoteFileOutboundGateway remoteFileTemplate, - MessageSessionCallback messageSessionCallback) { + MessageSessionCallback messageSessionCallback) { super(remoteFileTemplate, messageSessionCallback); } @@ -124,8 +132,7 @@ public class SftpOutboundGateway extends AbstractRemoteFileOutboundGateway