[ https://issues.apache.org/jira/browse/IO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17435796#comment-17435796 ]
Sita Geßner commented on IO-754: -------------------------------- [~ggregory] With this it's working for me. The breakpoint stops and the result is like in version 2.8.0: {code:java} @Override public FileVisitResult accept(final Path file, final BasicFileAttributes attributes) { if (super.accept(file.toFile(), file.getFileName().toString().toLowerCase())) { return FileVisitResult.CONTINUE; } return FileVisitResult.TERMINATE; } {code} I think it would help if the accept(File)-method is supported in the next version. If you don't like to support it anymore, it should be removed from the interface. > WildcardFileFilter should not ignore override accept-method > ----------------------------------------------------------- > > Key: IO-754 > URL: https://issues.apache.org/jira/browse/IO-754 > Project: Commons IO > Issue Type: Bug > Affects Versions: 2.9.0, 2.10.0, 2.11.0 > Reporter: Sita Geßner > Priority: Major > > I have a method to filter files with different extensions in a directory. > I did override the accept method for WildcardFileFilter because I want to > check the filename in lowercase, to find files with different spellings of > the fileextension. > After updating commons-io from 2.8.0 to 2.11.0 the accept-method is ignored. > The breakpoint won't stop in the accept-method. > Here is my codeexample: > {code:java} > public static void main(final String[] args) throws Exception { > final File directory = new File(FileUtils.getTempDirectory(), "TEST"); > directory.mkdir(); > new File(directory, "TEST").mkdir(); > new File(directory, "test1.pdf").createNewFile(); > new File(directory, "test1.txt").createNewFile(); > new File(directory, "test2.PDF").createNewFile(); > new File(directory, "test2.TXT").createNewFile(); > final IOFileFilter filter = new WildcardFileFilter("*.pdf", "*.txt") { > private static final long serialVersionUID = 1L; > @Override > public boolean accept(final File file) { > return super.accept(file, file.getName().toLowerCase()); > } > }; > for (final Iterator<File> itFiles = FileUtils.iterateFiles(directory, > filter, null); itFiles > .hasNext();) { > final File file = itFiles.next(); > System.out.println(file.getAbsolutePath()); > } > } > {code} > output in version 2.8.0: > {noformat} > /tmp/TEST/test2.PDF > /tmp/TEST/test1.txt > /tmp/TEST/test1.pdf > /tmp/TEST/test2.TXT > {noformat} > output in version 2.9.0 or higher: > {noformat} > /tmp/TEST/test1.txt > /tmp/TEST/test1.pdf > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)