Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 1.5.7, 1.6-beta-2, 1.7-beta-1
-
Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
-
Component/s: None
-
Labels:None
-
Environment:Windows, Ubuntu, Groovy, Java
-
Number of attachments :
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:
- Extract the code from Ant that does the path globbing and just use it or a variation of it.
- Transform the glob expression into a regular expression and then use regular expressions in the Java code.
- 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.
fixed