File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
flinkx-ftp/flinkx-ftp-core/src/main/java/com/dtstack/flinkx/ftp Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ public boolean isDirExist(String directoryPath) {
126126 public boolean isFileExist (String filePath ) {
127127 boolean isExitFlag = false ;
128128 try {
129+ ftpClient .enterLocalPassiveMode ();
129130 FTPFile [] ftpFiles = ftpClient .listFiles (new String (filePath .getBytes (StandardCharsets .UTF_8 ),FTP .DEFAULT_CONTROL_ENCODING ));
130131 if (ftpFiles .length == 1 && ftpFiles [0 ].isFile ()) {
131132 isExitFlag = true ;
@@ -147,6 +148,7 @@ public List<String> getFiles(String path) {
147148 path = path + SP ;
148149 }
149150 try {
151+ ftpClient .enterLocalPassiveMode ();
150152 FTPFile [] ftpFiles = ftpClient .listFiles (new String (path .getBytes (StandardCharsets .UTF_8 ),FTP .DEFAULT_CONTROL_ENCODING ));
151153 if (ftpFiles != null ) {
152154 for (FTPFile ftpFile : ftpFiles ) {
@@ -280,6 +282,7 @@ public void deleteAllFilesInDir(String dir, List<String> exclude) {
280282 @ Override
281283 public InputStream getInputStream (String filePath ) {
282284 try {
285+ ftpClient .enterLocalPassiveMode ();
283286 InputStream is = ftpClient .retrieveFileStream (new String (filePath .getBytes (StandardCharsets .UTF_8 ),FTP .DEFAULT_CONTROL_ENCODING ));
284287 return is ;
285288 } catch (IOException e ) {
You can’t perform that action at this time.
0 commit comments