* changed, return null.
*/
public Class loadClass(String fullClassName, boolean preload)
throws ClassNotFoundException
{
DynamicClassLoader preloadLoader = null;
try {
ClassLoader loader;
if (preload) {
preloadLoader = SimpleLoader.create(getPreloadLoader(),
getWorkDir(),
fullClassName);
// needed for cases like Amber enhancing
preloadLoader.setServletHack(true);
loader = preloadLoader;
}
else {
// XXX: because of automatic instantiation, might cause trouble
loader = getClassLoader();
if (loader == null) {
loader = SimpleLoader.create(getParentLoader(),
getWorkDir(),
fullClassName);
}
}
Class cl = Class.forName(fullClassName, false, loader);
if (cl == null)
return null;
if (! preload)
return cl;
if (isModified(cl)) {
return null;
}
if (_loader != null)
loader = _loader;
else {
loader = SimpleLoader.create(getParentLoader(),
getWorkDir(),
fullClassName);
}
cl = Class.forName(fullClassName, false, loader);
return cl;
} catch (RuntimeException e) {
if (! preload)
throw e;
else {
log.log(Level.FINE, e.toString(), e);
return null;
}
} catch (Error e) {
if (! preload)
throw e;
else {
log.log(Level.FINE, e.toString(), e);
return null;
}
} catch (ClassNotFoundException e) {
if (! preload)
throw e;
else
return null;
} finally {
if (preloadLoader != null)
preloadLoader.destroy();
}
}