[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-20 Thread Hao Liu (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15977959#comment-15977959
 ] 

Hao Liu commented on IO-531:


Thanks for all your quick replies and comments. 

As Sebb said maybe it's unnecessary.
And I think Sebb's suggestion is a very good workaround for me.
I will use "FileUtils.listFiles(directory, TrueFileFilter.TRUE, new 
NotFileFilter(new NameFileFilter("se")))" instead of my initial implementation.

Thank you.
BR,
Hao Liu.

> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
> Attachments: Commons IOIO-531.pdf
>
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-20 Thread Bernd Eckenfels (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15977384#comment-15977384
 ] 

Bernd Eckenfels commented on IO-531:


The test here implements the (null, trueFilter) case, but it uses 
FileFilterUtils.trueFileFilter, should the javadoc use this instead?

https://github.com/apache/commons-io/blob/master/src/test/java/org/apache/commons/io/FileUtilsListFilesTestCase.java#L161

> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
> Attachments: Commons IOIO-531.pdf
>
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-20 Thread Bernd Eckenfels (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15977370#comment-15977370
 ] 

Bernd Eckenfels commented on IO-531:


I am proposing a minor extension to the Javadoc anyway:

https://github.com/apache/commons-io/pull/33

> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
> Attachments: Commons IOIO-531.pdf
>
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15977367#comment-15977367
 ] 

ASF GitHub Bot commented on IO-531:
---

GitHub user ecki opened a pull request:

https://github.com/apache/commons-io/pull/33

[IO-531] JavaDoc to describe accept-any file filter



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ecki/commons-io patch-1

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-io/pull/33.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #33


commit 118d673fd7f8ac9bc9e342c0a3bbea05236e4b83
Author: Bernd 
Date:   2017-04-20T20:05:48Z

[IO-531] JavaDoc to describe accept-any file filter




> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
> Attachments: Commons IOIO-531.pdf
>
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-20 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15976384#comment-15976384
 ] 

Sebb commented on IO-531:
-

The PDF says:

{quote}
I want to use the org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, 
IOFileFilter) api to list all the files except the files in subdirectory “se”
{quote}

That could be coded as:

{code}
FileUtils.listFiles(directory, TrueFileFilter.TRUE, new NotFileFilter(new 
NameFileFilter("se")))
{code}

Note that you can also subclass AbstractFileFilter as follows:

{code}
new AbstractFileFilter() {
@Override
public boolean accept(File file) {
return ! file.getName().contains("se");
}
}
{code}

No need to check if the file is a directory as the dirfilter is only called for 
directories.

or you could use

{code}
new AbstractFileFilter() {
@Override
public boolean accept(File dir, String name) {
return ! name.contains("se");
}
}
{code}

Both would be closer to the solutions shown in the PDF which check for "se" in 
the directory name

> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
> Attachments: Commons IOIO-531.pdf
>
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-20 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15976375#comment-15976375
 ] 

Sebb commented on IO-531:
-

If I read you correctly, you want

{code}
FileUtils.listFiles(File, null, dirfilter)
{code}

to act as if you had coded

{code}
FileUtils.listFiles(File, TrueFileFilter.TRUE, dirfilter)
{code}

Is that correct?

I don't think that is a good idea, because null means the opposite - i.e. 
FalseFileFilter.FALSE - for the directory filter parameter.
That would be confusing.

It also seems unnecessary, given that there is already a (singleton) object 
which can be used (i.e. TrueFileFilter.TRUE).


> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
> Attachments: Commons IOIO-531.pdf
>
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-20 Thread Hao Liu (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15976203#comment-15976203
 ] 

Hao Liu commented on IO-531:


Hi, Sebb, 
I have attached a file. hope it could make myself clear.

Thank you.
BR,
Hao Liu.

> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
> Attachments: Commons IOIO-531.pdf
>
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-19 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15975579#comment-15975579
 ] 

Sebb commented on IO-531:
-

Sorry, but I'm still not clear what you want the null parameter to do.

Can you provide a test case?

Or at least a description of a simple directory structure and the results you 
want to get.

This will be needed to generate a unit test for any changes that might be made.

> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-19 Thread Hao Liu (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15974146#comment-15974146
 ] 

Hao Liu commented on IO-531:


I think that you misunderstood what I had described: I said the "Second 
Parameter" not the third one.
and I did know that there are some "Empty Implementations", such as 
TrueFileFilter and FalseFileFilter. however, I think it's not a very elegant 
solution.
as my understanding:
1, the second parameter is used for filtering files;
2, the third parameter is used for filtering directories.

When I only want to filter the subdirecotries, I just want to impement the 
third parameter, I didn't want to do anything about the second paramter.

In one word: When I only want to filter the subdirecotries, I hope that I can 
just set the second parameter to null and only focus on the implementation of 
the third parameter. I think this would be much more easy to use for the users.

BR,
Hao Liu.

> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IO-531) make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, IOFileFilter, IOFileFilter)

2017-04-18 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15972422#comment-15972422
 ] 

Sebb commented on IO-531:
-

The Javadoc [1] says:
"dirFilter optional filter to apply when finding subdirectories. If this 
parameter is null, subdirectories will not be included in the search. Use 
TrueFileFilter.INSTANCE to match all directories.
R"

Does FileUtils.listFiles(File, filter, TrueFileFilter.INSTANCE) not work for 
you?

[1] 
http://commons.apache.org/proper/commons-io/javadocs/api-2.5/org/apache/commons/io/FileUtils.html#listFiles(java.io.File,%20org.apache.commons.io.filefilter.IOFileFilter,%20org.apache.commons.io.filefilter.IOFileFilter)

> make it more esay-to-use: org.apache.commons.io.FileUtils.listFiles(File, 
> IOFileFilter, IOFileFilter)
> -
>
> Key: IO-531
> URL: https://issues.apache.org/jira/browse/IO-531
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.5
>Reporter: Hao Liu
>
> when I only want to filter the directories, it should be better to allow me 
> to set the second parameter to null or I have to implement the 
> org.apache.commons.io.filefilter.IOFileFilter interface with nothing 
> functionally task to do.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)