|
|
@ -46,35 +46,28 @@ public class TomcatEmbeddedWebappClassLoader extends WebappClassLoader {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public synchronized Class<?> loadClass(String name, boolean resolve)
|
|
|
|
public synchronized Class<?> loadClass(String name, boolean resolve)
|
|
|
|
throws ClassNotFoundException {
|
|
|
|
throws ClassNotFoundException {
|
|
|
|
Class<?> resultClass = null;
|
|
|
|
Class<?> result = findExistingLoadedClass(name);
|
|
|
|
|
|
|
|
result = (result == null ? doLoadClass(name) : result);
|
|
|
|
|
|
|
|
if (result == null) {
|
|
|
|
|
|
|
|
throw new ClassNotFoundException(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return resolveIfNecessary(result, resolve);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check local class caches
|
|
|
|
private Class<?> findExistingLoadedClass(String name) {
|
|
|
|
resultClass = (resultClass == null ? findLoadedClass0(name) : resultClass);
|
|
|
|
Class<?> resultClass = findLoadedClass0(name);
|
|
|
|
resultClass = (resultClass == null ? findLoadedClass(name) : resultClass);
|
|
|
|
resultClass = (resultClass == null ? findLoadedClass(name) : resultClass);
|
|
|
|
if (resultClass != null) {
|
|
|
|
return resultClass;
|
|
|
|
return resolveIfNecessary(resultClass, resolve);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check security
|
|
|
|
private Class<?> doLoadClass(String name) throws ClassNotFoundException {
|
|
|
|
checkPackageAccess(name);
|
|
|
|
checkPackageAccess(name);
|
|
|
|
|
|
|
|
if ((this.delegate || filter(name, true))) {
|
|
|
|
// Perform the actual load
|
|
|
|
Class<?> result = loadFromParent(name);
|
|
|
|
boolean delegateLoad = (this.delegate || filter(name, true));
|
|
|
|
return (result == null ? findClassIgnoringNotFound(name) : result);
|
|
|
|
|
|
|
|
|
|
|
|
if (delegateLoad) {
|
|
|
|
|
|
|
|
resultClass = (resultClass == null ? loadFromParent(name) : resultClass);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resultClass = (resultClass == null ? findClassIgnoringNotFound(name)
|
|
|
|
Class<?> result = findClassIgnoringNotFound(name);
|
|
|
|
: resultClass);
|
|
|
|
return (result == null ? loadFromParent(name) : result);
|
|
|
|
if (!delegateLoad) {
|
|
|
|
|
|
|
|
resultClass = (resultClass == null ? loadFromParent(name) : resultClass);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (resultClass == null) {
|
|
|
|
|
|
|
|
throw new ClassNotFoundException(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resolveIfNecessary(resultClass, resolve);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Class<?> resolveIfNecessary(Class<?> resultClass, boolean resolve) {
|
|
|
|
private Class<?> resolveIfNecessary(Class<?> resultClass, boolean resolve) {
|
|
|
|