[
https://issues.jboss.org/browse/JGRP-1762?page=com.atlassian.jira.plugin....
]
Bela Ban resolved JGRP-1762.
----------------------------
Resolution: Done
Changed the order: trying the defining classloader first, then the TCCL.
Util.loadClass(): do we use the correct ClassLoader ?
-----------------------------------------------------
Key: JGRP-1762
URL:
https://issues.jboss.org/browse/JGRP-1762
Project: JGroups
Issue Type: Task
Reporter: Bela Ban
Assignee: Bela Ban
Fix For: 3.4.2, 3.5
Investigate whether the code below uses the right classloader. Perhaps we should try to
get the classloader of the instances passed to us *before* attempting to use the calling
thread's class loader ?
The current code is:
{noformat}
public static Class loadClass(String classname, Class clazz) throws
ClassNotFoundException {
ClassLoader loader;
try {
loader=Thread.currentThread().getContextClassLoader();
if(loader != null) {
return loader.loadClass(classname);
}
}
catch(Throwable t) {
}
if(clazz != null) {
try {
loader=clazz.getClassLoader();
if(loader != null) {
return loader.loadClass(classname);
}
}
catch(Throwable t) {
}
}
try {
loader=ClassLoader.getSystemClassLoader();
if(loader != null) {
return loader.loadClass(classname);
}
}
catch(Throwable t) {
}
throw new ClassNotFoundException(classname);
}
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira