This is an automated email from the ASF dual-hosted git repository.

mattyb149 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new ff86426  NIFI-9436 - In AbstractPutHDFSRecord make sure the record 
writers use the FileSystem object the processor already has.
ff86426 is described below

commit ff864266f59e70a67b2a1f2c787a0f74464b6a9d
Author: Tamas Palfy <[email protected]>
AuthorDate: Thu Dec 2 18:56:40 2021 +0100

    NIFI-9436 - In AbstractPutHDFSRecord make sure the record writers use the 
FileSystem object the processor already has.
    
    Signed-off-by: Matthew Burgess <[email protected]>
    
    This closes #5565
---
 .../nifi/processors/hadoop/AbstractPutHDFSRecord.java      | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
 
b/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
index a595128..c2fb3bd 100644
--- 
a/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
+++ 
b/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
@@ -279,8 +279,18 @@ public abstract class AbstractPutHDFSRecord extends 
AbstractHadoopProcessor {
                 createDirectory(fileSystem, directoryPath, remoteOwner, 
remoteGroup);
 
                 // write to tempFile first and on success rename to destFile
-                final Path tempFile = new Path(directoryPath, "." + 
filenameValue);
-                final Path destFile = new Path(directoryPath, filenameValue);
+                final Path tempFile = new Path(directoryPath, "." + 
filenameValue) {
+                    @Override
+                    public FileSystem getFileSystem(Configuration conf) throws 
IOException {
+                        return fileSystem;
+                    }
+                };
+                final Path destFile = new Path(directoryPath, filenameValue) {
+                    @Override
+                    public FileSystem getFileSystem(Configuration conf) throws 
IOException {
+                        return fileSystem;
+                    }
+                };
 
                 final boolean destinationOrTempExists = 
fileSystem.exists(destFile) || fileSystem.exists(tempFile);
                 final boolean shouldOverwrite = 
context.getProperty(OVERWRITE).asBoolean();

Reply via email to