mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix ftpFiles length Exception
This commit is contained in:
parent
a0f5970037
commit
c0c3395296
@ -294,11 +294,11 @@ public class Ftp extends AbstractFtp {
|
|||||||
return ListUtil.empty();
|
return ListUtil.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<FTPFile> result = new ArrayList<>(ftpFiles.length - 2);
|
final List<FTPFile> result = new ArrayList<>(ftpFiles.length - 2 <= 0 ? ftpFiles.length : ftpFiles.length - 2);
|
||||||
String fileName;
|
String fileName;
|
||||||
for (FTPFile ftpFile : ftpFiles) {
|
for (FTPFile ftpFile : ftpFiles) {
|
||||||
fileName = ftpFile.getName();
|
fileName = ftpFile.getName();
|
||||||
if (false == StrUtil.equals(".", fileName) && false == StrUtil.equals("..", fileName)) {
|
if (!StrUtil.equals(".", fileName) && !StrUtil.equals("..", fileName)) {
|
||||||
if (null == filter || filter.accept(ftpFile)) {
|
if (null == filter || filter.accept(ftpFile)) {
|
||||||
result.add(ftpFile);
|
result.add(ftpFile);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user