mirror of https://github.com/apache/nifi.git
NIFI-7232 if users do not supply a remote path PutSFTP with conflict resolution will fail with an NPE
This commit is contained in:
parent
7c57e75da4
commit
20dda05f26
|
@ -39,6 +39,7 @@ import org.apache.nifi.processors.standard.util.FileInfo;
|
|||
import org.apache.nifi.processors.standard.util.FileTransfer;
|
||||
import org.apache.nifi.processors.standard.util.SFTPTransfer;
|
||||
import org.apache.nifi.util.StopWatch;
|
||||
import org.apache.nifi.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Base class for PutFTP & PutSFTP
|
||||
|
@ -102,8 +103,8 @@ public abstract class PutFileTransfer<T extends FileTransfer> extends AbstractPr
|
|||
do {
|
||||
final String rootPath = context.getProperty(FileTransfer.REMOTE_PATH).evaluateAttributeExpressions(flowFile).getValue();
|
||||
final String workingDirPath;
|
||||
if (rootPath == null) {
|
||||
workingDirPath = null;
|
||||
if (StringUtils.isBlank(rootPath)) {
|
||||
workingDirPath = transfer.getHomeDirectory(flowFile);
|
||||
} else {
|
||||
workingDirPath = transfer.getAbsolutePath(flowFile, rootPath);
|
||||
}
|
||||
|
|
|
@ -631,6 +631,7 @@ public class SFTPTransfer implements FileTransfer {
|
|||
try {
|
||||
this.homeDir = sftpClient.canonicalize("");
|
||||
} catch (IOException e) {
|
||||
this.homeDir = "";
|
||||
// For some combination of server configuration and user home directory, getHome() can fail with "2: File not found"
|
||||
// Since homeDir is only used tor SEND provenance event transit uri, this is harmless. Log and continue.
|
||||
logger.debug("Failed to retrieve {} home directory due to {}", new Object[]{username, e.getMessage()});
|
||||
|
|
Loading…
Reference in New Issue