优化Ftp.download,返回false抛出异常(issue#3805@Github)

This commit is contained in:
Looly 2024-12-04 12:20:55 +08:00
parent 7da0856314
commit 0c5444e442
2 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,7 @@
### 🐣新特性
* 【poi 】 优化ExcelWriter中使用比较器writer的方法只对第一条数据进行排序pr#3807@Github
* 【extra 】 优化Ftp.download返回false抛出异常issue#3805@Github
### 🐞Bug修复
* 【crypto 】 修复JWTSignerUtil.createSigner中algorithmId未转换问题issue#3806@Github

View File

@ -708,9 +708,11 @@ public class Ftp extends AbstractFtp {
if (null != fileNameCharset) {
fileName = new String(fileName.getBytes(fileNameCharset), StandardCharsets.ISO_8859_1);
}
boolean isSuccess;
try {
client.setFileType(FTPClient.BINARY_FILE_TYPE);
client.retrieveFile(fileName, out);
isSuccess = client.retrieveFile(fileName, out);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
@ -718,6 +720,10 @@ public class Ftp extends AbstractFtp {
cd(pwd);
}
}
if(false == isSuccess){
throw new FtpException("retrieveFile return false");
}
}
/**