Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3226

org.codehaus.groovy.tools.LoaderConfiguration fails to implement glob in expected fashion

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.5.7, 1.6-beta-2, 1.7-beta-1
    • 1.6-rc-1, 1.5.8, 1.7-beta-1
    • None
    • None
    • Windows, Ubuntu, Groovy, Java

    Description

      During startup, if the starter configuration file has a line:

      load !{ant.home}/lib/*.jar
      

      then all the jars in the directory

      {ant.home}/lib are added to the classpath of the root loader. However a line such as:
      
      

      load !{ant.home}

      /lib/ant*.jar

      
      

      results in no jars being added to the root loader classpath.

      The "globbing" implemented in org.codehaus.groovy.tools.LoaderConfiguration is violating the Rule of Least Surprise – in particular * is only being expanded if it is the first character of a path component. Either proper globbing shold be implemented or a switch to using regular expressions should be made.

      Globbing is clearly easier here for the user, but Java does not have a standard globbing sub-system, it only has support for regular expressions. Obvious directions:

      1. Extract the code from Ant that does the path globbing and just use it or a variation of it.
      2. Transform the glob expression into a regular expression and then use regular expressions in the Java code.
      3. Extend the current code to implement globbin so that it works in a more expected way.

      Given the string manipulation support in Java, 2 may be the best way forward.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            russel Dr. Russel Winder
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: