geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject cvs commit: incubator-geronimo/modules/twiddle/src/java/org/apache/geronimo/twiddle/config Configurator.java
Date Tue, 26 Aug 2003 08:23:07 GMT
jdillon     2003/08/26 01:23:07

  Modified:    modules/twiddle/src/java/org/apache/geronimo/twiddle/config
                        Configurator.java
  Log:
   o do not try to process glob if no '*' token
  
  Revision  Changes    Path
  1.9       +24 -10    incubator-geronimo/modules/twiddle/src/java/org/apache/geronimo/twiddle/config/Configurator.java
  
  Index: Configurator.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/twiddle/src/java/org/apache/geronimo/twiddle/config/Configurator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Configurator.java	24 Aug 2003 20:09:25 -0000	1.8
  +++ Configurator.java	26 Aug 2003 08:23:07 -0000	1.9
  @@ -161,6 +161,16 @@
           }
       }
       
  +    /**
  +     * Parse an array of URLs from a glob.
  +     *
  +     * <p>Only supports '*' glob token.
  +     *
  +     * @param globspec  The glob to parse.
  +     * @return          An array of URLs
  +     *
  +     * @throws MalformedURLException
  +     */
       protected URL[] parseGlobURLs(final String globspec) throws MalformedURLException
       {
           assert globspec != null;
  @@ -186,6 +196,11 @@
           }
           
           int i = glob.indexOf("*");
  +        if (i < 0) {
  +            // no glob
  +            return new URL[] { baseURL };
  +        }
  +        
           final String prefix = glob.substring(0, i);
           final String suffix = glob.substring(i + 1);
           if (trace) {
  @@ -193,17 +208,16 @@
               log.trace("Suffix: " + suffix);
           }
           
  -        File[] matches = dir.listFiles(new FilenameFilter()
  +        File[] matches = dir.listFiles(new FilenameFilter() {
  +            public boolean accept(final File dir, final String name)
               {
  -                public boolean accept(final File dir, final String name)
  -                {
  -                    if (!name.startsWith(prefix) || !name.endsWith(suffix)) {
  -                        return false;
  -                    }
  -                    
  -                    return true;
  +                if (!name.startsWith(prefix) || !name.endsWith(suffix)) {
  +                    return false;
                   }
  -            });
  +                
  +                return true;
  +            }
  +        });
           
           List list = new LinkedList();
           if (matches != null) {
  
  
  

Mime
View raw message