Adjusted auto-detection in FTP Processors
This closes
@@ -38,19 +38,19 @@ import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
-import static org.apache.nifi.processors.standard.util.FTPTransfer.createComponentProxyConfigSupplier;
import static org.apache.nifi.processors.standard.util.FTPTransfer.BUFFER_SIZE;
import static org.apache.nifi.processors.standard.util.FTPTransfer.CONNECTION_MODE;
import static org.apache.nifi.processors.standard.util.FTPTransfer.CONNECTION_MODE_ACTIVE;
-import static org.apache.nifi.processors.standard.util.FTPTransfer.DATA_TIMEOUT;
import static org.apache.nifi.processors.standard.util.FTPTransfer.CONNECTION_TIMEOUT;
-import static org.apache.nifi.processors.standard.util.FTPTransfer.UTF8_ENCODING;
-import static org.apache.nifi.processors.standard.util.FTPTransfer.USERNAME;
-import static org.apache.nifi.processors.standard.util.FTPTransfer.PASSWORD;
+import static org.apache.nifi.processors.standard.util.FTPTransfer.DATA_TIMEOUT;
import static org.apache.nifi.processors.standard.util.FTPTransfer.HOSTNAME;
+import static org.apache.nifi.processors.standard.util.FTPTransfer.PASSWORD;
import static org.apache.nifi.processors.standard.util.FTPTransfer.PORT;
import static org.apache.nifi.processors.standard.util.FTPTransfer.TRANSFER_MODE;
import static org.apache.nifi.processors.standard.util.FTPTransfer.TRANSFER_MODE_ASCII;
+import static org.apache.nifi.processors.standard.util.FTPTransfer.USERNAME;
+import static org.apache.nifi.processors.standard.util.FTPTransfer.UTF8_ENCODING;
+import static org.apache.nifi.processors.standard.util.FTPTransfer.createComponentProxyConfigSupplier;
/**
* Standard implementation of FTP Client Provider
@@ -150,11 +150,12 @@ public class StandardFTPClientProvider implements FTPClientProvider {
client.setDataTimeout(dataTimeout);
client.setDefaultTimeout(connectionTimeout);
client.setRemoteVerificationEnabled(false);
+ client.setAutodetectUTF8(true);
final boolean unicodeEnabled = context.getProperty(UTF8_ENCODING).isSet() ? context.getProperty(UTF8_ENCODING).asBoolean() : false;
+ // in non-UTF-8 mode, FTP control encoding should be left as default (ISO-8859-1)
if (unicodeEnabled) {
client.setControlEncoding(StandardCharsets.UTF_8.name());
- client.setAutodetectUTF8(true);
}
}
