You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Pier-Luc Caron St-Pierre (Created) (JIRA)" <ji...@apache.org> on 2011/11/05 13:40:51 UTC

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

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
             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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment: io-291-simple.diff

Attached is a much simpler implementation that works with:
- Unrealized File objects
- No recursion.
- Correct Javadoc
- No tabs.
                
> 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] [Issue Comment Edited] (IO-291) Add new function FileUtils.isContained

Posted by "Pier-Luc Caron St-Pierre (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13145123#comment-13145123 ] 

Pier-Luc Caron St-Pierre edited comment on IO-291 at 11/6/11 9:42 PM:
----------------------------------------------------------------------

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-simple.patch.
 * I have removed the author tag.
                
      was (Author: plcstpierre):
    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-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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment:     (was: io-291-simple.diff)
    
> 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
>
>
> 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

Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144704#comment-13144704 ] 

Gary D. Gregory commented on IO-291:
------------------------------------

I think a containsAll(Collection<Files>) 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

Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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

Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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] [Reopened] (IO-291) Add new function FileUtils.isContained

Posted by "Sebb (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb reopened IO-291:
---------------------


A bug needs to be left open until it has been completed; provision of a patch is only one stage in the process.

The patch may be rejected, or may require amendment.
                
> 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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment:     (was: io-291.diff)
    
> 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
>
>
> 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] [Resolved] (IO-291) Add new function FileUtils.isContained

Posted by "Pier-Luc Caron St-Pierre (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pier-Luc Caron St-Pierre resolved IO-291.
-----------------------------------------

    Resolution: Fixed
    
> 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: newbie, 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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Pier-Luc Caron St-Pierre (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pier-Luc Caron St-Pierre updated IO-291:
----------------------------------------

    Attachment: io-291-v5.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
>            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

Posted by "Sebb (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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] [Updated] (IO-291) Add new function FileUtils.directoryContains

Posted by "Henri Yandell (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated IO-291:
-----------------------------

    Fix Version/s: 2.2
    
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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.2
>
>         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.directoryContains

Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149636#comment-13149636 ] 

Gary D. Gregory commented on IO-291:
------------------------------------

Committed revision 1201713. This is a simple implementation that seems to make the most sense to me. Please discuss.
                
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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.2
>
>         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] [Issue Comment Edited] (IO-291) Add new function FileUtils.isContained

Posted by "Pier-Luc Caron St-Pierre (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13146045#comment-13146045 ] 

Pier-Luc Caron St-Pierre edited comment on IO-291 at 11/8/11 2:38 AM:
----------------------------------------------------------------------

I built 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?
                
      was (Author: plcstpierre):
    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] [Updated] (IO-291) Add new function FileUtils.directoryContains

Posted by "Sebb (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated IO-291:
--------------------

    Fix Version/s:     (was: 2.2)
    
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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
>         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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Pier-Luc Caron St-Pierre (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pier-Luc Caron St-Pierre updated IO-291:
----------------------------------------

    Attachment:     (was: FileUtils.isContained.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
>            Assignee: Gary D. Gregory
>              Labels: patch
>             Fix For: 2.1
>
>         Attachments: io-291-simple.diff, io-291-v4.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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment: io-291-simple.diff

Attached is a much simpler implementation that works with:
- Unrealized File objects
- No recursion.
                
> 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

Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Pier-Luc Caron St-Pierre (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pier-Luc Caron St-Pierre updated IO-291:
----------------------------------------

    Attachment: FileUtils.isContained.patch

The 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: newbie, 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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment: io-291-simple.diff

Attached is a much simpler implementation that works with:
- Unrealized File objects
- No recursion.
- Correct Javadoc
                
> 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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Fix Version/s:     (was: 2.1)
    
> 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
>         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

Posted by "Pier-Luc Caron St-Pierre (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Pier-Luc Caron St-Pierre (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pier-Luc Caron St-Pierre updated IO-291:
----------------------------------------

    Attachment: io-291-v4.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
>            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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment: io-291.diff

Attaching my version of the patch with discussed changes. What is not clear to me is if this is the best choice:

{code:java}
    public void testUnrealizedContainment() throws IOException {
	final File dir = new File("DOESNOTEXIST");
	final File file = new File(dir, "DOESNOTEXIST2");
        assertFalse(dir.exists());	
        assertFalse(file.exists());	
        assertFalse(FileUtils.contains(dir, file));
    }
{code}

as opposed to:
{code:java}
assertFalse(FileUtils.contains(dir, file));
{code}

The relationship in b/w parent and child is valid but unrealized on disk. Shouldn't contain value the relationship as valid even if unrealized? I am inclined to say yes.

Thoughts?
                
> 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

        

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

Posted by "Pier-Luc Caron St-Pierre (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pier-Luc Caron St-Pierre updated IO-291:
----------------------------------------

    Attachment:     (was: io-291-v4.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
>            Assignee: Gary D. Gregory
>              Labels: patch
>             Fix For: 2.1
>
>         Attachments: io-291-simple.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] [Issue Comment Edited] (IO-291) Add new function FileUtils.isContained

Posted by "Pier-Luc Caron St-Pierre (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13145123#comment-13145123 ] 

Pier-Luc Caron St-Pierre edited comment on IO-291 at 11/6/11 9:49 PM:
----------------------------------------------------------------------

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 in other context.

 * I have make some coding style fix in the io-291-simple.patch.
 * I have removed the author tag.
                
      was (Author: plcstpierre):
    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-simple.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-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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment:     (was: io-291-simple.diff)
    
> 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.directoryContains

Posted by "Niall Pemberton (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13181787#comment-13181787 ] 

Niall Pemberton commented on IO-291:
------------------------------------

Also the *meat* of the method seems more suited to FilenameUtils:

{{
// Canonicalize paths (normalizes relative paths)
String canonicalParent = directory.getCanonicalPath();
String canonicalChild = child.getCanonicalPath();

if (IOCase.SYSTEM.checkEquals(canonicalParent, canonicalChild)) {
    return false;
}

return IOCase.SYSTEM.checkStartsWith(canonicalChild, canonicalParent);
}}
                
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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.2
>
>         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

Posted by "Pier-Luc Caron St-Pierre (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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

Posted by "Sebb (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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

        

[jira] [Issue Comment Edited] (IO-291) Add new function FileUtils.directoryContains

Posted by "Niall Pemberton (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13181787#comment-13181787 ] 

Niall Pemberton edited comment on IO-291 at 1/7/12 2:50 AM:
------------------------------------------------------------

Also the *meat* of the method seems more suited to FilenameUtils:

{code}
// Canonicalize paths (normalizes relative paths)
String canonicalParent = directory.getCanonicalPath();
String canonicalChild = child.getCanonicalPath();

if (IOCase.SYSTEM.checkEquals(canonicalParent, canonicalChild)) {
    return false;
}

return IOCase.SYSTEM.checkStartsWith(canonicalChild, canonicalParent);
{code}
                
      was (Author: niallp):
    Also the *meat* of the method seems more suited to FilenameUtils:

{{
// Canonicalize paths (normalizes relative paths)
String canonicalParent = directory.getCanonicalPath();
String canonicalChild = child.getCanonicalPath();

if (IOCase.SYSTEM.checkEquals(canonicalParent, canonicalChild)) {
    return false;
}

return IOCase.SYSTEM.checkStartsWith(canonicalChild, canonicalParent);
}}
                  
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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.2
>
>         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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment:     (was: io-291-simple.diff)
    
> 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

        

[jira] [Updated] (IO-291) Add new function FileUtils.directoryContains

Posted by "Gary D. Gregory (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Fix Version/s: 2.2
    
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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.2
>
>         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] [Closed] (IO-291) Add new function FileUtils.directoryContains

Posted by "Gary D. Gregory (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory closed IO-291.
------------------------------

    Resolution: Fixed

Version 2.2 has been released and addresses this issue.
                
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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
>         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] [Updated] (IO-291) Add new function FileUtils.directoryContains

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Summary: Add new function FileUtils.directoryContains  (was: Add new function FileUtils.isContained)
    
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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
>         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] [Issue Comment Edited] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144719#comment-13144719 ] 

Gary D. Gregory edited comment on IO-291 at 11/5/11 3:21 PM:
-------------------------------------------------------------

Attaching my version of the patch with discussed changes. What is not clear to me is if this is the best choice:

{code:java}
    public void testUnrealizedContainment() throws IOException {
	final File dir = new File("DOESNOTEXIST");
	final File file = new File(dir, "DOESNOTEXIST2");
        assertFalse(dir.exists());	
        assertFalse(file.exists());	
        assertFalse(FileUtils.contains(dir, file));
    }
{code}

as opposed to:
{code:java}
assertTrue(FileUtils.contains(dir, file));
{code}

The relationship in b/w parent and child is valid but unrealized on disk. Shouldn't contain value the relationship as valid even if unrealized? I am inclined to say yes.

Thoughts?
                
      was (Author: garydgregory):
    Attaching my version of the patch with discussed changes. What is not clear to me is if this is the best choice:

{code:java}
    public void testUnrealizedContainment() throws IOException {
	final File dir = new File("DOESNOTEXIST");
	final File file = new File(dir, "DOESNOTEXIST2");
        assertFalse(dir.exists());	
        assertFalse(file.exists());	
        assertFalse(FileUtils.contains(dir, file));
    }
{code}

as opposed to:
{code:java}
assertFalse(FileUtils.contains(dir, file));
{code}

The relationship in b/w parent and child is valid but unrealized on disk. Shouldn't contain value the relationship as valid even if unrealized? I am inclined to say yes.

Thoughts?
                  
> 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

        

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

Posted by "Niall Pemberton (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13181784#comment-13181784 ] 

Niall Pemberton commented on IO-291:
------------------------------------

Seems very odd for the new method to return true if the file doesn't exist - I added a test case showing this:

http://svn.apache.org/viewvc?view=revision&revision=1228554
                
> Add new function FileUtils.directoryContains
> --------------------------------------------
>
>                 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.2
>
>         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

Posted by "Pier-Luc Caron St-Pierre (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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] [Updated] (IO-291) Add new function FileUtils.isContained

Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated IO-291:
-------------------------------

    Attachment: io-291-simple.diff

Let's try again:

Attached is a much simpler implementation that works with:

    Unrealized File objects
    No recursion.
    Correct Javadoc
    No tabs.


                
> 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
>
>
> 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