Merge pull request #3775 from eclipse/jetty-9.4.x-3736-protect-from-bad-classloader

Issue #3736 - Give better exception when using bad classloader impl
This commit is contained in:
Joakim Erdfelt 2019-06-12 16:18:01 -05:00 committed by GitHub
commit 070b8f9de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -498,7 +498,9 @@ public class WebAppClassLoader extends URLClassLoader implements ClassVisibility
// Try the parent loader // Try the parent loader
try try
{ {
parent_class = _parent.loadClass(name); parent_class = _parent.loadClass(name);
if (parent_class == null)
throw new ClassNotFoundException("Bad ClassLoader: returned null for loadClass(" + name + ")");
// If the webapp is allowed to see this class // If the webapp is allowed to see this class
if (Boolean.TRUE.equals(__loadServerClasses.get()) || !_context.isServerClass(parent_class)) if (Boolean.TRUE.equals(__loadServerClasses.get()) || !_context.isServerClass(parent_class))