[jira] [Created] (IO-281) WildcardFileFilter fails for wild card pattern with a '*' in it

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (IO-281) WildcardFileFilter fails for wild card pattern with a '*' in it

ASF GitHub Bot (Jira)
WildcardFileFilter fails for wild card pattern with a '*' in it
---------------------------------------------------------------

                 Key: IO-281
                 URL: https://issues.apache.org/jira/browse/IO-281
             Project: Commons IO
          Issue Type: Bug
          Components: Filters
    Affects Versions: 1.3.2
         Environment: Windows XP
            Reporter: Dean Schulze
            Priority: Blocker


The code below reports no files found when there is a file matching the wild card pattern.  If I enter this command in a DOS windows in the same directory it finds the file so the wild card pattern is correct as far as DOS is concerned:


C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
 
 Directory of C:\dean\clipper\src\metadata.mail

08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
               1 File(s)          9,728 bytes
               0 Dir(s)  50,033,049,600 bytes free

This code should work according to the docs but it reports no file found:


        void testFileNameFilter() throws IOException {
               
                String fileNamePrefix = "320620110821433";
                File f = new File(fileNamePrefix + ".rwd");
                String filterString = fileNamePrefix + "-*.RWD";
                FileFilter filter = new WildcardFileFilter(filterString, IOCase.SYSTEM);
                File dir = f.getCanonicalFile();
                File[] existingFiles = dir.listFiles(filter);
               
                if (existingFiles != null)
                        for (File f2 : existingFiles)
                                System.out.println(f2.getName());
                else
                        System.out.println("No files found for" + filterString);
        }



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (IO-281) WildcardFileFilter fails for wild card pattern with a '*' in it

ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/IO-281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated IO-281:
--------------------

    Description:
The code below reports no files found when there is a file matching the wild card pattern.  If I enter this command in a DOS windows in the same directory it finds the file so the wild card pattern is correct as far as DOS is concerned:

{code}
C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
 
 Directory of C:\dean\clipper\src\metadata.mail

08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
               1 File(s)          9,728 bytes
               0 Dir(s)  50,033,049,600 bytes free
{code}

This code should work according to the docs but it reports no file found:

{code}
        void testFileNameFilter() throws IOException {
               
                String fileNamePrefix = "320620110821433";
                File f = new File(fileNamePrefix + ".rwd");
                String filterString = fileNamePrefix + "-*.RWD";
                FileFilter filter = new WildcardFileFilter(filterString, IOCase.SYSTEM);
                File dir = f.getCanonicalFile();
                File[] existingFiles = dir.listFiles(filter);
               
                if (existingFiles != null)
                        for (File f2 : existingFiles)
                                System.out.println(f2.getName());
                else
                        System.out.println("No files found for" + filterString);
        }
{code}


  was:
The code below reports no files found when there is a file matching the wild card pattern.  If I enter this command in a DOS windows in the same directory it finds the file so the wild card pattern is correct as far as DOS is concerned:


C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
 
 Directory of C:\dean\clipper\src\metadata.mail

08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
               1 File(s)          9,728 bytes
               0 Dir(s)  50,033,049,600 bytes free

This code should work according to the docs but it reports no file found:


        void testFileNameFilter() throws IOException {
               
                String fileNamePrefix = "320620110821433";
                File f = new File(fileNamePrefix + ".rwd");
                String filterString = fileNamePrefix + "-*.RWD";
                FileFilter filter = new WildcardFileFilter(filterString, IOCase.SYSTEM);
                File dir = f.getCanonicalFile();
                File[] existingFiles = dir.listFiles(filter);
               
                if (existingFiles != null)
                        for (File f2 : existingFiles)
                                System.out.println(f2.getName());
                else
                        System.out.println("No files found for" + filterString);
        }




Fix layout

> WildcardFileFilter fails for wild card pattern with a '*' in it
> ---------------------------------------------------------------
>
>                 Key: IO-281
>                 URL: https://issues.apache.org/jira/browse/IO-281
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 1.3.2
>         Environment: Windows XP
>            Reporter: Dean Schulze
>            Priority: Blocker
>
> The code below reports no files found when there is a file matching the wild card pattern.  If I enter this command in a DOS windows in the same directory it finds the file so the wild card pattern is correct as far as DOS is concerned:
> {code}
> C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
>  
>  Directory of C:\dean\clipper\src\metadata.mail
> 08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
>                1 File(s)          9,728 bytes
>                0 Dir(s)  50,033,049,600 bytes free
> {code}
> This code should work according to the docs but it reports no file found:
> {code}
> void testFileNameFilter() throws IOException {
>
> String fileNamePrefix = "320620110821433";
> File f = new File(fileNamePrefix + ".rwd");
> String filterString = fileNamePrefix + "-*.RWD";
> FileFilter filter = new WildcardFileFilter(filterString, IOCase.SYSTEM);
> File dir = f.getCanonicalFile();
> File[] existingFiles = dir.listFiles(filter);
>
> if (existingFiles != null)
> for (File f2 : existingFiles)
> System.out.println(f2.getName());
> else
> System.out.println("No files found for" + filterString);
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (IO-281) WildcardFileFilter fails for wild card pattern with a '*' in it

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Sebb commented on IO-281:
-------------------------

Are you sure that the "dir" variable points to the correct directory? Try printing it out, and/or removing the filter.

> WildcardFileFilter fails for wild card pattern with a '*' in it
> ---------------------------------------------------------------
>
>                 Key: IO-281
>                 URL: https://issues.apache.org/jira/browse/IO-281
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 1.3.2
>         Environment: Windows XP
>            Reporter: Dean Schulze
>            Priority: Blocker
>
> The code below reports no files found when there is a file matching the wild card pattern.  If I enter this command in a DOS windows in the same directory it finds the file so the wild card pattern is correct as far as DOS is concerned:
> {code}
> C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
>  
>  Directory of C:\dean\clipper\src\metadata.mail
> 08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
>                1 File(s)          9,728 bytes
>                0 Dir(s)  50,033,049,600 bytes free
> {code}
> This code should work according to the docs but it reports no file found:
> {code}
> void testFileNameFilter() throws IOException {
>
> String fileNamePrefix = "320620110821433";
> File f = new File(fileNamePrefix + ".rwd");
> String filterString = fileNamePrefix + "-*.RWD";
> FileFilter filter = new WildcardFileFilter(filterString, IOCase.SYSTEM);
> File dir = f.getCanonicalFile();
> File[] existingFiles = dir.listFiles(filter);
>
> if (existingFiles != null)
> for (File f2 : existingFiles)
> System.out.println(f2.getName());
> else
> System.out.println("No files found for" + filterString);
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (IO-281) WildcardFileFilter fails for wild card pattern with a '*' in it

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Dean Schulze commented on IO-281:
---------------------------------

This looks like unexpected behavior from the Java File class.  If I create a File object for a file that exists in the current directory the various File methods all return either null or a path that ends with the file name instead of the directory name.

I've resorted to manually parsing off the file name from the end of the absolute path.

http://stackoverflow.com/questions/7153729/java-cant-get-the-path-of-a-file-that-exists-in-the-current-directory/7154296#7154296

This can probably be closed out.


> WildcardFileFilter fails for wild card pattern with a '*' in it
> ---------------------------------------------------------------
>
>                 Key: IO-281
>                 URL: https://issues.apache.org/jira/browse/IO-281
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 1.3.2
>         Environment: Windows XP
>            Reporter: Dean Schulze
>            Priority: Blocker
>
> The code below reports no files found when there is a file matching the wild card pattern.  If I enter this command in a DOS windows in the same directory it finds the file so the wild card pattern is correct as far as DOS is concerned:
> {code}
> C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
>  
>  Directory of C:\dean\clipper\src\metadata.mail
> 08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
>                1 File(s)          9,728 bytes
>                0 Dir(s)  50,033,049,600 bytes free
> {code}
> This code should work according to the docs but it reports no file found:
> {code}
> void testFileNameFilter() throws IOException {
>
> String fileNamePrefix = "320620110821433";
> File f = new File(fileNamePrefix + ".rwd");
> String filterString = fileNamePrefix + "-*.RWD";
> FileFilter filter = new WildcardFileFilter(filterString, IOCase.SYSTEM);
> File dir = f.getCanonicalFile();
> File[] existingFiles = dir.listFiles(filter);
>
> if (existingFiles != null)
> for (File f2 : existingFiles)
> System.out.println(f2.getName());
> else
> System.out.println("No files found for" + filterString);
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (IO-281) WildcardFileFilter fails for wild card pattern with a '*' in it

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/IO-281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved IO-281.
---------------------

    Resolution: Invalid

> WildcardFileFilter fails for wild card pattern with a '*' in it
> ---------------------------------------------------------------
>
>                 Key: IO-281
>                 URL: https://issues.apache.org/jira/browse/IO-281
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 1.3.2
>         Environment: Windows XP
>            Reporter: Dean Schulze
>            Priority: Blocker
>
> The code below reports no files found when there is a file matching the wild card pattern.  If I enter this command in a DOS windows in the same directory it finds the file so the wild card pattern is correct as far as DOS is concerned:
> {code}
> C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
>  
>  Directory of C:\dean\clipper\src\metadata.mail
> 08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
>                1 File(s)          9,728 bytes
>                0 Dir(s)  50,033,049,600 bytes free
> {code}
> This code should work according to the docs but it reports no file found:
> {code}
> void testFileNameFilter() throws IOException {
>
> String fileNamePrefix = "320620110821433";
> File f = new File(fileNamePrefix + ".rwd");
> String filterString = fileNamePrefix + "-*.RWD";
> FileFilter filter = new WildcardFileFilter(filterString, IOCase.SYSTEM);
> File dir = f.getCanonicalFile();
> File[] existingFiles = dir.listFiles(filter);
>
> if (existingFiles != null)
> for (File f2 : existingFiles)
> System.out.println(f2.getName());
> else
> System.out.println("No files found for" + filterString);
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Closed] (IO-281) WildcardFileFilter fails for wild card pattern with a '*' in it

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/IO-281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb closed IO-281.
-------------------


> WildcardFileFilter fails for wild card pattern with a '*' in it
> ---------------------------------------------------------------
>
>                 Key: IO-281
>                 URL: https://issues.apache.org/jira/browse/IO-281
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 1.3.2
>         Environment: Windows XP
>            Reporter: Dean Schulze
>            Priority: Blocker
>
> The code below reports no files found when there is a file matching the wild card pattern.  If I enter this command in a DOS windows in the same directory it finds the file so the wild card pattern is correct as far as DOS is concerned:
> {code}
> C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
>  
>  Directory of C:\dean\clipper\src\metadata.mail
> 08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
>                1 File(s)          9,728 bytes
>                0 Dir(s)  50,033,049,600 bytes free
> {code}
> This code should work according to the docs but it reports no file found:
> {code}
> void testFileNameFilter() throws IOException {
>
> String fileNamePrefix = "320620110821433";
> File f = new File(fileNamePrefix + ".rwd");
> String filterString = fileNamePrefix + "-*.RWD";
> FileFilter filter = new WildcardFileFilter(filterString, IOCase.SYSTEM);
> File dir = f.getCanonicalFile();
> File[] existingFiles = dir.listFiles(filter);
>
> if (existingFiles != null)
> for (File f2 : existingFiles)
> System.out.println(f2.getName());
> else
> System.out.println("No files found for" + filterString);
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira