From a638a40bcdc97886bec8140149b5754c77a4f8e0 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 30 Nov 2000 11:19:11 +0000 Subject: [PATCH] Fixed . 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 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268276 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Property.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Property.java b/src/main/org/apache/tools/ant/taskdefs/Property.java index 81401d44e..fd340c79e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -178,7 +178,15 @@ public class Property extends Task { Properties props = new Properties(); log("Resource Loading " + name, Project.MSG_VERBOSE); 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) { props.load(is); addProperties(props);