[jira] [Commented] (IO-754) WildcardFileFilter should not ignore override accept-method
[ https://issues.apache.org/jira/browse/IO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17558055#comment-17558055 ] Sita Geßner commented on IO-754: [~ggregory] I've implemented the workaround so far. I think it's ok to deprecate the method at least. > 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 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.20.7#820007)
[jira] [Commented] (IO-754) WildcardFileFilter should not ignore override accept-method
[ https://issues.apache.org/jira/browse/IO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17558048#comment-17558048 ] Gary D. Gregory commented on IO-754: [~sgessner] ping? > 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 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.20.7#820007)
[jira] [Commented] (IO-754) WildcardFileFilter should not ignore override accept-method
[ https://issues.apache.org/jira/browse/IO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17435976#comment-17435976 ] Gary D. Gregory commented on IO-754: The intent was not to break existing apps of course. This is an unintended side effect and I am sorry it has caused you this issue. If you can find a way to still support old and new apps, then we would love to get a PR on GitHub, if not we will take your advice and at least deprecate the method. > 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 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)
[jira] [Commented] (IO-754) WildcardFileFilter should not ignore override accept-method
[ https://issues.apache.org/jira/browse/IO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17435973#comment-17435973 ] Sita Geßner commented on IO-754: Ok then the method accept(File)-method should be supported or throw an UnsupportedOperationException in my opinion. Also it should be marked as deprecated, so SonarLint would show this to me. > 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 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)
[jira] [Commented] (IO-754) WildcardFileFilter should not ignore override accept-method
[ https://issues.apache.org/jira/browse/IO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17435967#comment-17435967 ] Gary D. Gregory commented on IO-754: We will not remove a method from an interface within a major release as this would break binary compatibility. > 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 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)
[jira] [Commented] (IO-754) WildcardFileFilter should not ignore override accept-method
[ https://issues.apache.org/jira/browse/IO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 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)
[jira] [Commented] (IO-754) WildcardFileFilter should not ignore override accept-method
[ https://issues.apache.org/jira/browse/IO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17435581#comment-17435581 ] Gary D. Gregory commented on IO-754: What happens if you override {{accept(Path path, BasicFileAttributes attributes)}}? > 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 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)