TyrantLucifer commented on code in PR #2483:
URL: 
https://github.com/apache/incubator-seatunnel/pull/2483#discussion_r950812133


##########
seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/ftp/util/FtpFileUtils.java:
##########
@@ -33,37 +34,45 @@
 
 public class FtpFileUtils {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(FtpFileUtils.class);
-    public  static FTPClient FTPCLIENT;
+    public static FTPClient FTPCLIENT;
     public static  String FTP_PASSWORD;
     public static  String FTP_USERNAME;
     public static  String FTP_HOST;
     public static  Integer FTP_PORT;
     public static final int FTP_CONNECT_MAX_TIMEOUT = 30000;
 
     public static FTPClient getFTPClient(){
-        return getFTPClient(FTP_HOST, FTP_PORT, FTP_USERNAME, FTP_PASSWORD);
+        if (StringUtils.isBlank(FTP_HOST) || StringUtils.isBlank(FTP_USERNAME) 
|| StringUtils.isBlank(FTP_PASSWORD) || 
StringUtils.isBlank(FTP_PORT.toString())) {

Review Comment:
   Because your `FTP_PASSWORD` is public, so everyone can change this attribute 
to `NULL`. So it's possibly return null for your code. And I think use these 
four attributes to judge FTPCLIENT is or not existed not suitable. You should 
ensure that your singleton pattern is globally thread-safe.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to