|
|
@@ -21,7 +21,9 @@ import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.net.URL; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Enumeration; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.NoSuchElementException; |
|
|
|
import java.util.Properties; |
|
|
@@ -41,6 +43,15 @@ import org.apache.tools.ant.types.EnumeratedAttribute; |
|
|
|
* @since Ant 1.4 |
|
|
|
*/ |
|
|
|
public abstract class Definer extends DefBase { |
|
|
|
private static class ResourceStack extends ThreadLocal { |
|
|
|
public Object initialValue() { |
|
|
|
return new ArrayList(); |
|
|
|
} |
|
|
|
List getStack() { |
|
|
|
return (List) get(); |
|
|
|
} |
|
|
|
} |
|
|
|
private static ResourceStack resourceStack = new ResourceStack(); |
|
|
|
private String name; |
|
|
|
private String classname; |
|
|
|
private File file; |
|
|
@@ -179,6 +190,9 @@ public abstract class Definer extends DefBase { |
|
|
|
Enumeration/*<URL>*/ urls = null; |
|
|
|
if (file != null) { |
|
|
|
final URL url = fileToURL(); |
|
|
|
if (url == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
urls = new Enumeration() { |
|
|
|
private boolean more = true; |
|
|
|
public boolean hasMoreElements() { |
|
|
@@ -209,7 +223,18 @@ public abstract class Definer extends DefBase { |
|
|
|
loadProperties(al, url); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
loadAntlib(al, url); |
|
|
|
if (resourceStack.getStack().contains(url)) { |
|
|
|
log("Warning: Attempting to recursively load " + url |
|
|
|
+ " at " + getLocation(), |
|
|
|
Project.MSG_WARN); |
|
|
|
} else { |
|
|
|
try { |
|
|
|
resourceStack.getStack().add(url); |
|
|
|
loadAntlib(al, url); |
|
|
|
} finally { |
|
|
|
resourceStack.getStack().remove(url); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|