Browse Source

Fixed <property resource="...">. The old implementation would serach

for org/apache/tools/ant/taskdefs/RESOURCE when RESOURCE was a
relative filename (this is the main difference between
Class.getResource and ClassLoader.getResource).

Reported by:	Jason Rosenberg <jason@squaretrade.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268276 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
a638a40bcd
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/main/org/apache/tools/ant/taskdefs/Property.java

+ 9
- 1
src/main/org/apache/tools/ant/taskdefs/Property.java View File

@@ -178,7 +178,15 @@ public class Property extends Task {
Properties props = new Properties(); Properties props = new Properties();
log("Resource Loading " + name, Project.MSG_VERBOSE); log("Resource Loading " + name, Project.MSG_VERBOSE);
try { try {
InputStream is = this.getClass().getResourceAsStream(name);
ClassLoader cL = this.getClass().getClassLoader();
InputStream is = null;

if (cL == null) {
is = ClassLoader.getSystemResourceAsStream(name);
} else {
is = cL.getResourceAsStream(name);
}
if (is != null) { if (is != null) {
props.load(is); props.load(is);
addProperties(props); addProperties(props);


Loading…
Cancel
Save