nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ymda...@apache.org
Subject nifi git commit: NIFI-4137: Add support for UTF-8 in GetFTP and PutFTP
Date Wed, 28 Jun 2017 20:42:19 GMT
Repository: nifi
Updated Branches:
  refs/heads/master c99c036c2 -> 9bfa7469c


NIFI-4137: Add support for UTF-8 in GetFTP and PutFTP

Signed-off-by: Yolanda M. Davis <ymdavis@apache.org>

This closes #1957


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/9bfa7469
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/9bfa7469
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/9bfa7469

Branch: refs/heads/master
Commit: 9bfa7469cb8a2ea3ce6cec9ae5766efe2213ea4c
Parents: c99c036
Author: Matt Burgess <mattyb149@apache.org>
Authored: Wed Jun 28 13:09:55 2017 -0400
Committer: Yolanda M. Davis <ymdavis@apache.org>
Committed: Wed Jun 28 16:41:14 2017 -0400

----------------------------------------------------------------------
 .../org/apache/nifi/processors/standard/GetFTP.java   |  1 +
 .../org/apache/nifi/processors/standard/PutFTP.java   |  1 +
 .../nifi/processors/standard/util/FTPTransfer.java    | 14 ++++++++++++++
 3 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/9bfa7469/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFTP.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFTP.java
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFTP.java
index 7c78faa..e60ef3a 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFTP.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFTP.java
@@ -81,6 +81,7 @@ public class GetFTP extends GetFileTransfer {
         properties.add(FTPTransfer.PROXY_PORT);
         properties.add(FTPTransfer.HTTP_PROXY_USERNAME);
         properties.add(FTPTransfer.HTTP_PROXY_PASSWORD);
+        properties.add(FTPTransfer.UTF8_ENCODING);
         this.properties = Collections.unmodifiableList(properties);
     }
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/9bfa7469/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutFTP.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutFTP.java
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutFTP.java
index 1679982..734ad6a 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutFTP.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutFTP.java
@@ -94,6 +94,7 @@ public class PutFTP extends PutFileTransfer<FTPTransfer> {
         properties.add(FTPTransfer.PROXY_PORT);
         properties.add(FTPTransfer.HTTP_PROXY_USERNAME);
         properties.add(FTPTransfer.HTTP_PROXY_PASSWORD);
+        properties.add(FTPTransfer.UTF8_ENCODING);
 
         this.properties = Collections.unmodifiableList(properties);
     }

http://git-wip-us.apache.org/repos/asf/nifi/blob/9bfa7469/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
index 85486c3..b64a6f8 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java
@@ -105,6 +105,15 @@ public class FTPTransfer implements FileTransfer {
         .required(false)
         .sensitive(true)
         .build();
+    public static final PropertyDescriptor UTF8_ENCODING = new PropertyDescriptor.Builder()
+            .name("ftp-use-utf8")
+            .displayName("Use UTF-8 Encoding")
+            .description("Tells the client to use UTF-8 encoding when processing files and
filenames. If set to true, the server must also support UTF-8 encoding.")
+            .required(true)
+            .allowableValues("true", "false")
+            .defaultValue("false")
+            .addValidator(StandardValidators.BOOLEAN_VALIDATOR)
+            .build();
 
     private final ComponentLog logger;
 
@@ -529,6 +538,11 @@ public class FTPTransfer implements FileTransfer {
             inetAddress = InetAddress.getByName(remoteHostname);
         }
 
+        final boolean useUtf8Encoding = ctx.getProperty(UTF8_ENCODING).isSet() ? ctx.getProperty(UTF8_ENCODING).asBoolean()
: false;
+        if (useUtf8Encoding) {
+            client.setControlEncoding("UTF-8");
+        }
+
         client.connect(inetAddress, ctx.getProperty(PORT).evaluateAttributeExpressions(flowFile).asInteger());
         this.closed = false;
         client.setDataTimeout(ctx.getProperty(DATA_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue());


Mime
View raw message