INT-4230: Fix (S)FTP Preserve Timestamp on MGET

JIRA: https://jira.spring.io/browse/INT-4230

The `get()` method only preserves the timestamp when an LS operation is done within it.
For MGET ops, we don't perform another LS, so the timestamp was not updated.

Add code to the recursive and non-recursive MGET methods to preserve the timestamp if so configured.
This commit is contained in:
Gary Russell
2017-02-19 12:32:49 -05:00
committed by Artem Bilan
parent 7558b847fb
commit b30f404173
5 changed files with 106 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -954,8 +954,11 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
*/
String fileName = this.getRemoteFilename(fullFileName);
String actualRemoteDirectory = this.getRemoteDirectory(fullFileName, fileName);
File file = this.get(message, session, actualRemoteDirectory,
File file = get(message, session, actualRemoteDirectory,
fullFileName, fileName, false);
if (this.options.contains(Option.PRESERVE_TIMESTAMP)) {
file.setLastModified(getModified(lsEntry.getFileInfo()));
}
files.add(file);
}
}
@@ -997,8 +1000,11 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
*/
String fileName = this.getRemoteFilename(fullFileName);
String actualRemoteDirectory = this.getRemoteDirectory(fullFileName, fileName);
File file = this.get(message, session, actualRemoteDirectory,
File file = get(message, session, actualRemoteDirectory,
fullFileName, fileName, false);
if (this.options.contains(Option.PRESERVE_TIMESTAMP)) {
file.setLastModified(getModified(lsEntry.getFileInfo()));
}
files.add(file);
}
}