ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15017] New: - taskdef + getResourceAsStream broken
Date Tue, 03 Dec 2002 09:01:37 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15017>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15017

taskdef + getResourceAsStream broken

           Summary: taskdef + getResourceAsStream broken
           Product: Ant
           Version: 1.5.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: elkner@linofee.org


<taskdef name="makepdf"
	classname="org.apache.fop.tools.anttasks.Fop">
	<classpath>
		<path refid="classpath.extensions"/>
		<pathelement path="${build.class.dir}"/>
		<pathelement path="${classpath.main}"/>  <!-- ant stuff -->
	</classpath>
</taskdef>

so classpath contains definitely fop.jar.

But when running the task, all 
Thread.currentThread().getContextClassLoader().getResourceAsStream(RES_PATH + file)
e.g. with RES_PATH = "org/apache/fop/conf/";
and file = "config.xml";

return null!

fop.jar definitely contains org/apache/fop/conf/config.xml ...


Digging around, I found, that 
Thread.currentThread().getContextClassLoader() resolves to the system 
classloader and not to the antclassloader:

Finding class org.apache.fop.layout.hyphenation.Hyphenator
Class org.apache.fop.layout.hyphenation.Hyphenator loaded from ant loader
  [makepdf] 09:54:56,021 [main] DEBUG (Hyphenator.java:84) - ClassLoader:
sun.misc.Launcher$AppClassLoader@1a457b6
  [makepdf] 09:54:56,028 [main] DEBUG (Hyphenator.java:86) - ClassLoader2:
org.apache.tools.ant.AntClassLoader@166afb3


produced by:

cl = Thread.currentThread().getContextClassLoader();
			log.debug("ClassLoader: " + (cl != null ? cl.toString() : "null"));
			cl = Hyphenator.class.getClassLoader();
			log.debug("ClassLoader2: " + (cl != null ? cl.toString() : "null"));

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message