You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2005/09/19 22:07:49 UTC
DO NOT REPLY [Bug 36717] New: -
Ant does not correctly set the current thread's ContextClassLoader before starting a task
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36717>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=36717
Summary: Ant does not correctly set the current thread's
ContextClassLoader before starting a task
Product: Ant
Version: 1.6.2
Platform: Other
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Core
AssignedTo: dev@ant.apache.org
ReportedBy: yonas.jongkind@gmail.com
I am generating dynamic class files within an Ant task using Javassist.
The bug is best illustraighted by the following code snippet (from execute
within my ant task):
System.out.println("CL1: "+Thread.currentThread().getContextClassLoader());
System.out.println("CL2: "+this.getClass().getClassLoader());
The output is:
[MyTask] CL1: java.net.URLClassLoader@82ba41
[MyTask] CL2: org.apache.tools.ant.loader.AntClassLoader2@1c1ea29
The workaround for my code is:
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
Which causes Javassist to work perfectly.
Yonas.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org