garydgregory commented on code in PR #827:
URL: https://github.com/apache/commons-io/pull/827#discussion_r2779441487
##########
src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java:
##########
@@ -53,7 +54,7 @@ private static CopyOption[] toCopyOption(final CopyOption...
copyOptions) {
* @param copyOptions Specifies how the copying should be done.
*/
public CopyDirectoryVisitor(final PathCounters pathCounter, final Path
sourceDirectory, final Path targetDirectory, final CopyOption... copyOptions) {
- super(pathCounter);
+ super(pathCounter, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
Review Comment:
I think we have interactions to define for users:
- before the PR, we were calling `super(pathCounter)`, which means the
default file filer is `new SymbolicLinkFileFilter(FileVisitResult.TERMINATE,
FileVisitResult.CONTINUE)` and the default dir filter is
`TrueFileFilter.INSTANCE`
- In this PR, we set both to `TrueFileFilter.INSTANCE`, so no change for
dirs.
It seems both could be "wrong" in the sense that they compete with
`CopyOption...` which can contain `java.nio.file.LinkOption.NOFOLLOW_LINKS`.
I'm sorry this is all confusing! We have:
- `java.nio.file.LinkOption.NOFOLLOW_LINKS` (where `LinkOption implements
OpenOption, CopyOption`)
- `java.nio.file.FileVisitOption.FOLLOW_LINKS`
- An IO file filter
- An IO dir filter
I understand we have a bug, but we should take this opportunity to document
what this change means.
I should add that if coming up with a good solution means adding APIs and/or
deprecating existing ones, I'm OK with that.
I also would like to create a release candidate to pick up existing fixes
(for other Commons components and projects) but I don't want to rush this
issue. If you see a release candidate tag or emails on the dev mailing list,
it's for that reason, not because I don't think this is important :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]