Skip to content

Commit 970dc22

Browse files
authored
Optimize readDir where filtering is required (#5810)
* Switch to Java NIO for readDirInternal * Revert "Switch to Java NIO for readDirInternal" This reverts commit ab7601f. * Tactical fix
1 parent ee1abfa commit 970dc22

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,10 @@ public List<String> perform() {
842842
} else {
843843
FilenameFilter fnFilter;
844844
if (filter != null) {
845+
Pattern fnPattern = Pattern.compile(filter);
845846
fnFilter = new FilenameFilter() {
846847
public boolean accept(File dir, String name) {
847-
return Pattern.matches(filter, name);
848+
return fnPattern.matcher(name).matches();
848849
}
849850
};
850851
} else {

0 commit comments

Comments
 (0)