File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
spring-integration-file/src/main/java/org/springframework/integration/file Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2017 the original author or authors.
2+ * Copyright 2017-2018 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -70,12 +70,13 @@ public void setFileVisitOptions(FileVisitOption... fileVisitOptions) {
7070 public List <File > listFiles (File directory ) throws IllegalArgumentException {
7171 FileListFilter <File > filter = getFilter ();
7272 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 ));
7980
8081 if (supportAcceptFilter ) {
8182 return fileStream .collect (Collectors .toList ());
You can’t perform that action at this time.
0 commit comments