[
https://issues.apache.org/jira/browse/IO-467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14296830#comment-14296830
]
Benedikt Ritter commented on IO-467:
------------------------------------
The problem is that {{NAME_COMPARATOR}} is defined as follows:
{code:java}
public static final Comparator<File> NAME_COMPARATOR = new NameFileComparator();
{code}
So you're trying to call sort on a Comparator instance and the Comparator
interface does not define the sort method. To make your example work, change
your code to:
{code:java}
package myfiles.rename;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.DirectoryWalker;
import org.apache.commons.io.comparator.NameFileComparator;
public class FileRenamer extends DirectoryWalker<String> {
private static final NameFileComparator COMPARATOR = new
NameFileComparator();
@Override
protected File[] filterDirectoryContents(File directory, int depth, File[]
files) throws IOException {
COMPARATOR.sort(files);
return files;
}
}
{code}
> AbstractFileComparator class is not declared 'public'
> -----------------------------------------------------
>
> Key: IO-467
> URL: https://issues.apache.org/jira/browse/IO-467
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.4
> Reporter: Lutz Reder
>
> The AbstractFileComparator class in Commons IO 2.4 is not declared 'public',
> so the sort method is not visible outside its package .
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)