File tree 1 file changed +8
-7
lines changed
spring-integration-file/src/main/java/org/springframework/integration/file
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2017 the original author or authors.
2
+ * Copyright 2017-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -70,12 +70,13 @@ public void setFileVisitOptions(FileVisitOption... fileVisitOptions) {
70
70
public List <File > listFiles (File directory ) throws IllegalArgumentException {
71
71
FileListFilter <File > filter = getFilter ();
72
72
boolean supportAcceptFilter = filter instanceof AbstractFileListFilter ;
73
- try {
74
- Stream <File > fileStream = Files .walk (directory .toPath (), this .maxDepth , this .fileVisitOptions )
75
- .skip (1 )
76
- .map (Path ::toFile )
77
- .filter (file -> !supportAcceptFilter
78
- || ((AbstractFileListFilter <File >) filter ).accept (file ));
73
+ try (Stream <Path > pathStream = Files .walk (directory .toPath (), this .maxDepth , this .fileVisitOptions );) {
74
+ Stream <File > fileStream =
75
+ pathStream
76
+ .skip (1 )
77
+ .map (Path ::toFile )
78
+ .filter (file -> !supportAcceptFilter
79
+ || ((AbstractFileListFilter <File >) filter ).accept (file ));
79
80
80
81
if (supportAcceptFilter ) {
81
82
return fileStream .collect (Collectors .toList ());
You can’t perform that action at this time.
0 commit comments