src/main/java/org/jboss/net/protocol/file/FileURLLister.java
/**
    * Starting from baseUrl, that should point to a directory, populate the
    * resultList with the contents that pass the filter (in the form of URLs)
    * and possibly recurse into subdris not containing a '.' in their name.
    */
Starting from baseUrl, that should point to a directory, populate the
resultList with the contents that pass the filter (in the form of URLs)
and possibly recurse into subdris not containing a '.' in their name.
Starting from baseUrl that should point to a directory populate the resultList with the contents that pass the filter ( in the form of URLs ) and possibly recurse into subdris not containing a ' . ' in their name .
private void listFiles(final URL baseUrl, final URLFilter filter, boolean scanNonDottedSubDirs, ArrayList<URL> resultList)
      throws IOException
   {      
      final File baseDir = new File(baseUrl.getPath());
      String[] filenames = baseDir.list(new FilenameFilter()
      {
         public boolean accept(File dir, String name)
         {
            try
            {
               return filter.accept(baseUrl, name);
            }
            catch (Exception e)
            {
               log.debug("Unexpected exception filtering entry '" + name + "' in directory '" + baseDir + "'", e);
               return true;
            }
         }
      });
      if (filenames == null)
      {
         throw new IOException("Could not list directory '" + baseDir + "', reason unknown");
      }      
      else
      {
         String baseUrlString = baseUrl.toString();
         for (int i = 0; i < filenames.length; i++)
         {
            String filename = filenames[i];
            File file = new File(baseDir, filename);
            boolean isDir = file.isDirectory();
            URL subUrl = createURL(baseUrlString, filename, isDir);
            if (scanNonDottedSubDirs && isDir && (filename.indexOf('.') == -1))
            {
               listFiles(subUrl, filter, scanNonDottedSubDirs, resultList);
            }
            else
            {
               resultList.add(subUrl);                
            }
         }
      }
   }
private void listFiles ( final URL baseUrl , final URLFilter filter , boolean scanNonDottedSubDirs , ArrayList < URL > resultList ) throws IOException { final File baseDir = new File ( baseUrl . getPath ( ) ) ; String [ ] filenames = baseDir . list ( new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { try { return filter . accept ( baseUrl , name ) ; } catch ( Exception e ) { log . debug ( "Unexpected exception filtering entry '" + name + "' in directory '" + baseDir + "'" , e ) ; return true ; } } } ) ; if ( filenames == null ) { throw new IOException ( "Could not list directory '" + baseDir + "', reason unknown" ) ; } else { String baseUrlString = baseUrl . toString ( ) ; for ( int i = 0 ; i < filenames . length ; i ++ ) { String filename = filenames [ i ] ; File file = new File ( baseDir , filename ) ; boolean isDir = file . isDirectory ( ) ; URL subUrl = createURL ( baseUrlString , filename , isDir ) ; if ( scanNonDottedSubDirs && isDir && ( filename . indexOf ( '.' ) == - 1 ) ) { listFiles ( subUrl , filter , scanNonDottedSubDirs , resultList ) ; } else { resultList . add ( subUrl ) ; } } } }
Starting from baseUrl, that should point to a directory, populate the
 resultList with the contents that pass the filter (in the form of URLs)
 and possibly recurse into subdris not containing a '.'
Starting from baseUrl that should point to a directory populate the resultList with the contents that pass the filter ( in the form of URLs ) and possibly recurse into subdris not containing a ' . '
// List the files at the current dir level, using the provided filter // This happens only when baseDir not a directory (but this is already // checked by the caller) or some unknown IOException happens internally // (e.g. run out of file descriptors?). Unfortunately the File API // doesn't provide a way to know. // Find out if this is a directory // The subUrl // If scanning subdirs and we have a directory, not containing a '.' in // the name, recurse into it. This is to allow recursing into grouping // dirs like ./deploy/jms, ./deploy/management, etc., avoiding // at the same time exploded packages, like .sar, .war, etc. // recurse into it // just add to the list