NIFI-11472 Check working directory after making directory in PutFTP

- Multiple threads can attempt to create a remote directory when PutFTP has multiple concurrent tasks.

This closes #7184

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Daniel Aaron Salwerowicz 2023-04-20 11:47:37 +02:00 committed by exceptionfactory
parent 1fa5da9a55
commit d3f2bf1c16
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
1 changed files with 1 additions and 1 deletions

View File

@ -395,7 +395,7 @@ public class FTPTransfer implements FileTransfer {
if (!cdSuccessful) {
if (client.makeDirectory(remoteDirectory)) {
logger.debug("Remote Directory not found: created directory [{}]", remoteDirectory);
} else {
} else if (!setWorkingDirectory(remoteDirectory)) { // Double check that the dir exists as it might have been created in another thread
throw new IOException("Failed to create remote directory " + remoteDirectory);
}
}