[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-07 Thread Sebb (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13145596#comment-13145596
 ] 

Sebb commented on IO-291:
-

bq. No tabs.

The file io-291-simple.diff still contains some tabs.

By the way, when uploading a replacement patch, please delete any file(s) that 
are totally superseded by the new patch.
Unfortunately JIRA does not have any way to mark patches as obsolete.


 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
Assignee: Gary D. Gregory
  Labels: patch
 Fix For: 2.1

 Attachments: FileUtils.isContained.patch, io-291-simple.diff, 
 io-291-v4.patch, io-291.diff


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-07 Thread Pier-Luc Caron St-Pierre (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13146045#comment-13146045
 ] 

Pier-Luc Caron St-Pierre commented on IO-291:
-

I build on top of your patch. So if you apply my patch (io-291-v5.patch) from 
scratch, you should have our combined changes.

 * I have implemented the directoryContains(final File directory, final File 
child) 
 * I have added some test case for the newly implemented function.
 * I have Added some javadoc, renamed some parameters
 * I have corrected the code style of the test to match the original style.

We have some issues to address :

 * Actually the test case fail on testSameFile() because the case is tester on 
a file. It fail the rule that a directory cannot be a file
 * Does a directory contain itself? I do not have strong opinions about that.
 * Does a file contain itself? I do not have strong opinions about that.
 * In the scope of the method directoryContains(final File directory, final 
File child), what will happens if the files is an empty collection?

 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
Assignee: Gary D. Gregory
  Labels: patch
 Fix For: 2.1

 Attachments: io-291-simple.diff, io-291-v5.patch


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-06 Thread Pier-Luc Caron St-Pierre (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13145123#comment-13145123
 ] 

Pier-Luc Caron St-Pierre commented on IO-291:
-

Thanks for you input.

The initial use case is that I am exposing all the content of a folder to my 
user by a web service. I trust the lib to sanitize correctly the parameters, 
but I am afraid that my function will be used by my coworker in other context.

 * I have make some coding style fix in the io-291-v4.patch.
 * I have removed the author tag.

 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
Assignee: Gary D. Gregory
  Labels: patch
 Fix For: 2.1

 Attachments: FileUtils.isContained.patch, io-291-simple.diff, 
 io-291.diff


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-05 Thread Gary D. Gregory (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13144693#comment-13144693
 ] 

Gary D. Gregory commented on IO-291:


For these kinds of methods I prefer, contains(parent, child) where the first 
argument is the receiver of the verb and the following arguments are the actual 
arguments. Which would translate to parent.contains(child). The is like the 
Collection.contains method.

The next issue is whether contains(file, file) should return true or false. 
Does a file contain itself? Does a directory contains itself? 

If you think of a directory as a collection of files and directories, it does 
not, unless . is listed.

 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
  Labels: patch
 Fix For: 2.1

 Attachments: FileUtils.isContained.patch


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-05 Thread Pier-Luc Caron St-Pierre (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13144697#comment-13144697
 ] 

Pier-Luc Caron St-Pierre commented on IO-291:
-

Does the prefix 'candidate' for the parameters names add some value or should I 
remove it?

 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
  Labels: patch
 Fix For: 2.1

 Attachments: FileUtils.isContained.patch


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-05 Thread Gary D. Gregory (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13144703#comment-13144703
 ] 

Gary D. Gregory commented on IO-291:


I do not think having candidate in the name helps. 

 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
  Labels: patch
 Fix For: 2.1

 Attachments: FileUtils.isContained.patch


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-05 Thread Gary D. Gregory (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13144704#comment-13144704
 ] 

Gary D. Gregory commented on IO-291:


I think a containsAll(CollectionFiles) method should also be in this patch. 

 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
  Labels: patch
 Fix For: 2.1

 Attachments: FileUtils.isContained.patch


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-05 Thread Gary D. Gregory (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13144708#comment-13144708
 ] 

Gary D. Gregory commented on IO-291:


I've applied the patch to my working copy and am working on small changes...

 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
  Labels: patch
 Fix For: 2.1

 Attachments: FileUtils.isContained.patch


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-291) Add new function FileUtils.isContained

2011-11-05 Thread Sebb (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13144746#comment-13144746
 ] 

Sebb commented on IO-291:
-

What is the original use case? 
Maybe knowing that would help inform decisions on whether files and/or 
directories contain themselves and whether parameters need to exist or not.

Note that the behaviour of getCanonicalFile() may depend on whether or not the 
file exists, from the Javadoc:

{quote}
The canonical form of the pathname of a nonexistent file or directory may be 
different from the canonical form of the same pathname after the file or 
directory is created. Similarly, the canonical form of the pathname of an 
existing file or directory may be different from the canonical form of the same 
pathname after the file or directory is deleted.
{quote}

I don't like the recursive implementation; also it should not be necessary to 
call getCanonicalFile() multiple times.
It's also unsafe to call it multiple times as the representation may 
potentially change because of the above.

==
The io-291.diff patch contains tabs, and is an Eclipse workspace-relative patch 
so is difficult for anyone else to apply.

Both patches contain @author tags, which we discourage.


 Add new function FileUtils.isContained
 --

 Key: IO-291
 URL: https://issues.apache.org/jira/browse/IO-291
 Project: Commons IO
  Issue Type: New Feature
  Components: Utilities
Affects Versions: 2.1
Reporter: Pier-Luc Caron St-Pierre
Assignee: Gary D. Gregory
  Labels: patch
 Fix For: 2.1

 Attachments: FileUtils.isContained.patch, io-291.diff


 I added a function that determines whether the specified leaf is contains by 
 the specified composite.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira