Prechádzať zdrojové kódy

修复:出现假死,采用被动模式。

lym 2 rokov pred
rodič
commit
89cd50d800

+ 6 - 3
src/main/java/com/hywa/banktest/bankframework/utils/FtpUtil.java

@@ -44,6 +44,8 @@ public class FtpUtil {
 				throw new RuntimeException("登陆ftp服务器失败");
 			}
 			log.info(ftpClient.getReplyString());
+			//出现假死,采用被动模式。
+			ftpClient.enterLocalPassiveMode();
 			return ftpClient;
 		} catch (MalformedURLException e) {
 			e.printStackTrace();
@@ -99,7 +101,7 @@ public class FtpUtil {
 			ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
 			ftpClient.makeDirectory(pathname);
 			ftpClient.changeWorkingDirectory(pathname);
-			ftpClient.enterLocalPassiveMode();
+			//ftpClient.enterLocalPassiveMode();
 			ftpClient.storeFile(fileName, inputStream);
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -130,7 +132,7 @@ public class FtpUtil {
 			ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
 			ftpClient.makeDirectory(pathname);
 			ftpClient.changeWorkingDirectory(pathname);
-			ftpClient.enterLocalPassiveMode();
+			//ftpClient.enterLocalPassiveMode();
 			ftpClient.storeFile(fileName, inputStream);
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -156,6 +158,7 @@ public class FtpUtil {
 		}
 		FTPFile[] ftpFileArr = null;
 		try {
+			//ftpClient.enterLocalPassiveMode();
 			ftpFileArr = ftpClient.listFiles(ftpFileName);
 		} catch (IOException e2) {
 			e2.printStackTrace();
@@ -244,7 +247,7 @@ public class FtpUtil {
 
 			for (String ftpFileName:ftpFileNames) {
 				try {
-					ftpClient.enterLocalPassiveMode();
+					//ftpClient.enterLocalPassiveMode();
 					FTPFile[] ftpFileArr = ftpClient.listFiles(ftpFileName);
 					//文件存在下载到本地
 					if (null == ftpFileArr || ftpFileArr.length > 0) {