SymbolicLinkFileFilter

2023-04-12 Thread Miguel Muñoz
It's not clear what exactly this filter is supposed to do. From its
behavior, I gather that it's supposed to distinguish files from
directories, treating Symbolic links as ordinary files. There are two
reasons why this isn't clear.

1. This behavior (usually) seems identical to that of a filter that just
relies on File.isDirectory().
2. The current behavior is inconsistent:

I made a test directory with four entries: a file, a directory, and a
symbolic link to each.

I wrote code using SymbolicLinkFileFilter.INSTANCE as a FileFilter, a
FileNameFilter, and a PathFilter. I created a second filter that relied on
File.isDirectory(). The two filters behaved the same for three of the
files, but differed for the symbolic link to the directory. (I'm not sure
if the filter should treat that as a file or a directory, since it's not a
directory, but it resolves as one.)

Used as a FileFilter and a FileNameFilter, the accept() methods returned
false. Used as a PathFilter, it returned FileVisitResult.CONTINUE, which
essentially means true.

Looking through the code, the difference in behavior is apparently because
the call to resolve the PathFilter is the only one that calls
Files.isSymbolicLink().

I could fix this, but I don't know which behavior is correct.

I'll send you my test code if you want it.

— Miguel Muñoz


Re: [JEXL] Compatibility bug?

2023-04-12 Thread Henri Biestro
Done. :-)

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org