@Test public void loadFromAppIfNotInContainer() throws Exception { assertTrue(URLClassLoaderFirst.shouldSkip("javax.wsdl.WSDLException")); final URLClassLoader parent = new URLClassLoader(new URL[0]) { @Override public URL getResource(final String name) { if ("javax/wsdl/WSDLException.class".equals(name)) { return null; } return super.getResource(name); } }; final URLClassLoader tmpLoader = new URLClassLoaderFirst(new URL[]{JarLocation.jarLocation(WSDLException.class).toURI().toURL()}, parent); SystemInstance.init(new Properties()); SystemInstance.get().setComponent(ParentClassLoaderFinder.class, new ParentClassLoaderFinder() { @Override public ClassLoader getParentClassLoader(final ClassLoader fallback) { return parent; } }); final ClassLoader old = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(tmpLoader); try { assertFalse(URLClassLoaderFirst.shouldSkip("javax.wsdl.WSDLException")); } finally { Thread.currentThread().setContextClassLoader(old); SystemInstance.reset(); } assertTrue(URLClassLoaderFirst.shouldSkip("javax.wsdl.WSDLException")); SystemInstance.reset(); }
public static boolean shouldSkip(final String name) { if (name == null) { return false; } for (final String prefix : FORCED_SKIP) { if (name.startsWith(prefix)) { return true; } } for (final String prefix : FORCED_LOAD) { if (name.startsWith(prefix)) { return false; } } if (name.startsWith("java.")) { return true; } if (name.startsWith("javax.faces.")) { return false; } if (name.startsWith("javax.mail.")) { return false; } if (name.startsWith("javax.") || name.startsWith("jakarta.")) { return isInServer(name); } if (name.startsWith("sun.")) { return isInJvm(name); } if (name.startsWith("javax.servlet.jsp.jstl")) { return false; } if (name.startsWith("org.")) { final String org = name.substring("org.".length()); if (org.startsWith("apache.")) { final String apache = org.substring("apache.".length()); if (apache.startsWith("webbeans.jsf")) { return false; } if (apache.startsWith("tomee.mojarra.")) { return false; } if (apache.startsWith("bval.")) { return true; } if (apache.startsWith("openjpa.")) { return true; } if (apache.startsWith("xbean.")) { return !apache.substring("xbean.".length()).startsWith("spring"); } if (apache.startsWith("geronimo.")) { return true; } if (apache.startsWith("coyote.")) { return true; } if (apache.startsWith("webbeans.")) { return true; } if (apache.startsWith("log4j.") && SKIP_LOG4J) { return true; } if (apache.startsWith("catalina.")) { return true; } if (apache.startsWith("jasper.")) { return true; } if (apache.startsWith("tomcat.")) { return true; } if (apache.startsWith("el.")) { return true; } if (apache.startsWith("naming.")) { return true; } if (apache.startsWith("taglibs.standard.")) { return true; } if (apache.startsWith("openejb.")) { return !isWebAppEnrichment(apache.substring("openejb.".length())); } if (apache.startsWith("commons.")) { final String commons = apache.substring("commons.".length()); if (commons.startsWith("beanutils.")) { return isInServer(name); } if (commons.startsWith("cli.")) { return true; } if (commons.startsWith("codec.")) { return true; } if (commons.startsWith("collections.")) { return true; } if (commons.startsWith("dbcp.")) { return true; } if (commons.startsWith("dbcp2.")) { return true; } if (commons.startsWith("digester.")) { return true; } if (commons.startsWith("jocl.")) { return true; } if (commons.startsWith("lang.")) { return true; } if (commons.startsWith("lang3.")) { return true; } if (commons.startsWith("logging.")) { return false; } if (commons.startsWith("pool.")) { return true; } if (commons.startsWith("pool2.")) { return true; } if (commons.startsWith("net.") && SKIP_COMMONS_NET) { return true; } return false; } if (SKIP_MYFACES && apache.startsWith("myfaces.")) { final String myfaces = name.substring("myfaces.".length()); if (myfaces.startsWith("shared.")) { return true; } if (myfaces.startsWith("ee.")) { return true; } if (myfaces.startsWith("lifecycle.")) { return true; } if (myfaces.startsWith("context.")) { return true; } if (myfaces.startsWith("logging.")) { return true; } if (myfaces.startsWith("component.visit.") || myfaces.equals("component.ComponentResourceContainer")) { return true; } if (myfaces.startsWith("application.")) { return true; } if (myfaces.startsWith("config.")) { return true; } if (myfaces.startsWith("event.")) { return true; } if (myfaces.startsWith("resource.")) { return true; } if (myfaces.startsWith("el.")) { return true; } if (myfaces.startsWith("spi.")) { return true; } if (myfaces.startsWith("convert.")) { return true; } if (myfaces.startsWith("debug.")) { return true; } if (myfaces.startsWith("util.")) { return true; } if (myfaces.startsWith("view.")) { return true; } if (myfaces.equals("convert.ConverterUtils")) { return true; } if (myfaces.startsWith("renderkit.")) { final String renderkit = myfaces.substring("renderkit.".length()); if (renderkit.startsWith("html.Html")) { return true; } final char firstNextletter = renderkit.charAt(0); if (Character.isUpperCase(firstNextletter)) { return true; } return false; } if (myfaces.startsWith("taglib.")) { final String taglib = myfaces.substring("taglib.".length()); if (taglib.startsWith("html.Html")) { return true; } if (taglib.startsWith("core.")) { return true; } return false; } if (myfaces.startsWith("webapp.")) { final String webapp = myfaces.substring("webapp.".length()); if (webapp.startsWith("Faces")) { return true; } if (webapp.startsWith("Jsp")) { return true; } if (webapp.startsWith("Startup")) { return true; } if (webapp.equals("AbstractFacesInitializer")) { return true; } if (webapp.equals("MyFacesServlet")) { return true; } if (webapp.equals("ManagedBeanDestroyerListener")) { return true; } if (webapp.equals("WebConfigParamsLogger")) { return true; } return false; } return false; } if (apache.startsWith("activemq.")) { return SKIP_JMS && isInServer(name); } return false; } if (org.startsWith("hsqldb.") && SKIP_HSQLDB) { return true; } if (org.startsWith("codehaus.swizzle.")) { final String swizzle = org.substring("codehaus.swizzle.".length()); if (swizzle.startsWith("stream.")) { return true; } if (swizzle.startsWith("rss.")) { return true; } if (swizzle.startsWith("Grep.class") || swizzle.startsWith("Lexer.class")) { return true; } return false; } if (org.startsWith("w3c.dom.") || org.startsWith("xml.sax.")) { return isInJvm(name); } if (org.startsWith("eclipse.jdt.")) { return true; } return false; } if (name.startsWith("com.")) { final String sub = name.substring("com.".length()); if (sub.startsWith("sun.")) { return !name.startsWith("sun.mail.") && isInJvm(name); } if (sub.startsWith("oracle.")) { return true; } } if (name.startsWith("jdk.")) { return true; } if (name.startsWith("serp.bytecode.")) { return true; } return false; }
URLClassLoaderFirst extends URLClassLoader { public static boolean shouldSkip(final String name) { if (name == null) { return false; } for (final String prefix : FORCED_SKIP) { if (name.startsWith(prefix)) { return true; } } for (final String prefix : FORCED_LOAD) { if (name.startsWith(prefix)) { return false; } } if (name.startsWith("java.")) { return true; } if (name.startsWith("javax.faces.")) { return false; } if (name.startsWith("javax.mail.")) { return false; } if (name.startsWith("javax.") || name.startsWith("jakarta.")) { return isInServer(name); } if (name.startsWith("sun.")) { return isInJvm(name); } if (name.startsWith("javax.servlet.jsp.jstl")) { return false; } if (name.startsWith("org.")) { final String org = name.substring("org.".length()); if (org.startsWith("apache.")) { final String apache = org.substring("apache.".length()); if (apache.startsWith("webbeans.jsf")) { return false; } if (apache.startsWith("tomee.mojarra.")) { return false; } if (apache.startsWith("bval.")) { return true; } if (apache.startsWith("openjpa.")) { return true; } if (apache.startsWith("xbean.")) { return !apache.substring("xbean.".length()).startsWith("spring"); } if (apache.startsWith("geronimo.")) { return true; } if (apache.startsWith("coyote.")) { return true; } if (apache.startsWith("webbeans.")) { return true; } if (apache.startsWith("log4j.") && SKIP_LOG4J) { return true; } if (apache.startsWith("catalina.")) { return true; } if (apache.startsWith("jasper.")) { return true; } if (apache.startsWith("tomcat.")) { return true; } if (apache.startsWith("el.")) { return true; } if (apache.startsWith("naming.")) { return true; } if (apache.startsWith("taglibs.standard.")) { return true; } if (apache.startsWith("openejb.")) { return !isWebAppEnrichment(apache.substring("openejb.".length())); } if (apache.startsWith("commons.")) { final String commons = apache.substring("commons.".length()); if (commons.startsWith("beanutils.")) { return isInServer(name); } if (commons.startsWith("cli.")) { return true; } if (commons.startsWith("codec.")) { return true; } if (commons.startsWith("collections.")) { return true; } if (commons.startsWith("dbcp.")) { return true; } if (commons.startsWith("dbcp2.")) { return true; } if (commons.startsWith("digester.")) { return true; } if (commons.startsWith("jocl.")) { return true; } if (commons.startsWith("lang.")) { return true; } if (commons.startsWith("lang3.")) { return true; } if (commons.startsWith("logging.")) { return false; } if (commons.startsWith("pool.")) { return true; } if (commons.startsWith("pool2.")) { return true; } if (commons.startsWith("net.") && SKIP_COMMONS_NET) { return true; } return false; } if (SKIP_MYFACES && apache.startsWith("myfaces.")) { final String myfaces = name.substring("myfaces.".length()); if (myfaces.startsWith("shared.")) { return true; } if (myfaces.startsWith("ee.")) { return true; } if (myfaces.startsWith("lifecycle.")) { return true; } if (myfaces.startsWith("context.")) { return true; } if (myfaces.startsWith("logging.")) { return true; } if (myfaces.startsWith("component.visit.") || myfaces.equals("component.ComponentResourceContainer")) { return true; } if (myfaces.startsWith("application.")) { return true; } if (myfaces.startsWith("config.")) { return true; } if (myfaces.startsWith("event.")) { return true; } if (myfaces.startsWith("resource.")) { return true; } if (myfaces.startsWith("el.")) { return true; } if (myfaces.startsWith("spi.")) { return true; } if (myfaces.startsWith("convert.")) { return true; } if (myfaces.startsWith("debug.")) { return true; } if (myfaces.startsWith("util.")) { return true; } if (myfaces.startsWith("view.")) { return true; } if (myfaces.equals("convert.ConverterUtils")) { return true; } if (myfaces.startsWith("renderkit.")) { final String renderkit = myfaces.substring("renderkit.".length()); if (renderkit.startsWith("html.Html")) { return true; } final char firstNextletter = renderkit.charAt(0); if (Character.isUpperCase(firstNextletter)) { return true; } return false; } if (myfaces.startsWith("taglib.")) { final String taglib = myfaces.substring("taglib.".length()); if (taglib.startsWith("html.Html")) { return true; } if (taglib.startsWith("core.")) { return true; } return false; } if (myfaces.startsWith("webapp.")) { final String webapp = myfaces.substring("webapp.".length()); if (webapp.startsWith("Faces")) { return true; } if (webapp.startsWith("Jsp")) { return true; } if (webapp.startsWith("Startup")) { return true; } if (webapp.equals("AbstractFacesInitializer")) { return true; } if (webapp.equals("MyFacesServlet")) { return true; } if (webapp.equals("ManagedBeanDestroyerListener")) { return true; } if (webapp.equals("WebConfigParamsLogger")) { return true; } return false; } return false; } if (apache.startsWith("activemq.")) { return SKIP_JMS && isInServer(name); } return false; } if (org.startsWith("hsqldb.") && SKIP_HSQLDB) { return true; } if (org.startsWith("codehaus.swizzle.")) { final String swizzle = org.substring("codehaus.swizzle.".length()); if (swizzle.startsWith("stream.")) { return true; } if (swizzle.startsWith("rss.")) { return true; } if (swizzle.startsWith("Grep.class") || swizzle.startsWith("Lexer.class")) { return true; } return false; } if (org.startsWith("w3c.dom.") || org.startsWith("xml.sax.")) { return isInJvm(name); } if (org.startsWith("eclipse.jdt.")) { return true; } return false; } if (name.startsWith("com.")) { final String sub = name.substring("com.".length()); if (sub.startsWith("sun.")) { return !name.startsWith("sun.mail.") && isInJvm(name); } if (sub.startsWith("oracle.")) { return true; } } if (name.startsWith("jdk.")) { return true; } if (name.startsWith("serp.bytecode.")) { return true; } return false; } }
URLClassLoaderFirst extends URLClassLoader { public static boolean shouldSkip(final String name) { if (name == null) { return false; } for (final String prefix : FORCED_SKIP) { if (name.startsWith(prefix)) { return true; } } for (final String prefix : FORCED_LOAD) { if (name.startsWith(prefix)) { return false; } } if (name.startsWith("java.")) { return true; } if (name.startsWith("javax.faces.")) { return false; } if (name.startsWith("javax.mail.")) { return false; } if (name.startsWith("javax.") || name.startsWith("jakarta.")) { return isInServer(name); } if (name.startsWith("sun.")) { return isInJvm(name); } if (name.startsWith("javax.servlet.jsp.jstl")) { return false; } if (name.startsWith("org.")) { final String org = name.substring("org.".length()); if (org.startsWith("apache.")) { final String apache = org.substring("apache.".length()); if (apache.startsWith("webbeans.jsf")) { return false; } if (apache.startsWith("tomee.mojarra.")) { return false; } if (apache.startsWith("bval.")) { return true; } if (apache.startsWith("openjpa.")) { return true; } if (apache.startsWith("xbean.")) { return !apache.substring("xbean.".length()).startsWith("spring"); } if (apache.startsWith("geronimo.")) { return true; } if (apache.startsWith("coyote.")) { return true; } if (apache.startsWith("webbeans.")) { return true; } if (apache.startsWith("log4j.") && SKIP_LOG4J) { return true; } if (apache.startsWith("catalina.")) { return true; } if (apache.startsWith("jasper.")) { return true; } if (apache.startsWith("tomcat.")) { return true; } if (apache.startsWith("el.")) { return true; } if (apache.startsWith("naming.")) { return true; } if (apache.startsWith("taglibs.standard.")) { return true; } if (apache.startsWith("openejb.")) { return !isWebAppEnrichment(apache.substring("openejb.".length())); } if (apache.startsWith("commons.")) { final String commons = apache.substring("commons.".length()); if (commons.startsWith("beanutils.")) { return isInServer(name); } if (commons.startsWith("cli.")) { return true; } if (commons.startsWith("codec.")) { return true; } if (commons.startsWith("collections.")) { return true; } if (commons.startsWith("dbcp.")) { return true; } if (commons.startsWith("dbcp2.")) { return true; } if (commons.startsWith("digester.")) { return true; } if (commons.startsWith("jocl.")) { return true; } if (commons.startsWith("lang.")) { return true; } if (commons.startsWith("lang3.")) { return true; } if (commons.startsWith("logging.")) { return false; } if (commons.startsWith("pool.")) { return true; } if (commons.startsWith("pool2.")) { return true; } if (commons.startsWith("net.") && SKIP_COMMONS_NET) { return true; } return false; } if (SKIP_MYFACES && apache.startsWith("myfaces.")) { final String myfaces = name.substring("myfaces.".length()); if (myfaces.startsWith("shared.")) { return true; } if (myfaces.startsWith("ee.")) { return true; } if (myfaces.startsWith("lifecycle.")) { return true; } if (myfaces.startsWith("context.")) { return true; } if (myfaces.startsWith("logging.")) { return true; } if (myfaces.startsWith("component.visit.") || myfaces.equals("component.ComponentResourceContainer")) { return true; } if (myfaces.startsWith("application.")) { return true; } if (myfaces.startsWith("config.")) { return true; } if (myfaces.startsWith("event.")) { return true; } if (myfaces.startsWith("resource.")) { return true; } if (myfaces.startsWith("el.")) { return true; } if (myfaces.startsWith("spi.")) { return true; } if (myfaces.startsWith("convert.")) { return true; } if (myfaces.startsWith("debug.")) { return true; } if (myfaces.startsWith("util.")) { return true; } if (myfaces.startsWith("view.")) { return true; } if (myfaces.equals("convert.ConverterUtils")) { return true; } if (myfaces.startsWith("renderkit.")) { final String renderkit = myfaces.substring("renderkit.".length()); if (renderkit.startsWith("html.Html")) { return true; } final char firstNextletter = renderkit.charAt(0); if (Character.isUpperCase(firstNextletter)) { return true; } return false; } if (myfaces.startsWith("taglib.")) { final String taglib = myfaces.substring("taglib.".length()); if (taglib.startsWith("html.Html")) { return true; } if (taglib.startsWith("core.")) { return true; } return false; } if (myfaces.startsWith("webapp.")) { final String webapp = myfaces.substring("webapp.".length()); if (webapp.startsWith("Faces")) { return true; } if (webapp.startsWith("Jsp")) { return true; } if (webapp.startsWith("Startup")) { return true; } if (webapp.equals("AbstractFacesInitializer")) { return true; } if (webapp.equals("MyFacesServlet")) { return true; } if (webapp.equals("ManagedBeanDestroyerListener")) { return true; } if (webapp.equals("WebConfigParamsLogger")) { return true; } return false; } return false; } if (apache.startsWith("activemq.")) { return SKIP_JMS && isInServer(name); } return false; } if (org.startsWith("hsqldb.") && SKIP_HSQLDB) { return true; } if (org.startsWith("codehaus.swizzle.")) { final String swizzle = org.substring("codehaus.swizzle.".length()); if (swizzle.startsWith("stream.")) { return true; } if (swizzle.startsWith("rss.")) { return true; } if (swizzle.startsWith("Grep.class") || swizzle.startsWith("Lexer.class")) { return true; } return false; } if (org.startsWith("w3c.dom.") || org.startsWith("xml.sax.")) { return isInJvm(name); } if (org.startsWith("eclipse.jdt.")) { return true; } return false; } if (name.startsWith("com.")) { final String sub = name.substring("com.".length()); if (sub.startsWith("sun.")) { return !name.startsWith("sun.mail.") && isInJvm(name); } if (sub.startsWith("oracle.")) { return true; } } if (name.startsWith("jdk.")) { return true; } if (name.startsWith("serp.bytecode.")) { return true; } return false; } URLClassLoaderFirst(final URL[] urls, final ClassLoader parent); }
URLClassLoaderFirst extends URLClassLoader { public static boolean shouldSkip(final String name) { if (name == null) { return false; } for (final String prefix : FORCED_SKIP) { if (name.startsWith(prefix)) { return true; } } for (final String prefix : FORCED_LOAD) { if (name.startsWith(prefix)) { return false; } } if (name.startsWith("java.")) { return true; } if (name.startsWith("javax.faces.")) { return false; } if (name.startsWith("javax.mail.")) { return false; } if (name.startsWith("javax.") || name.startsWith("jakarta.")) { return isInServer(name); } if (name.startsWith("sun.")) { return isInJvm(name); } if (name.startsWith("javax.servlet.jsp.jstl")) { return false; } if (name.startsWith("org.")) { final String org = name.substring("org.".length()); if (org.startsWith("apache.")) { final String apache = org.substring("apache.".length()); if (apache.startsWith("webbeans.jsf")) { return false; } if (apache.startsWith("tomee.mojarra.")) { return false; } if (apache.startsWith("bval.")) { return true; } if (apache.startsWith("openjpa.")) { return true; } if (apache.startsWith("xbean.")) { return !apache.substring("xbean.".length()).startsWith("spring"); } if (apache.startsWith("geronimo.")) { return true; } if (apache.startsWith("coyote.")) { return true; } if (apache.startsWith("webbeans.")) { return true; } if (apache.startsWith("log4j.") && SKIP_LOG4J) { return true; } if (apache.startsWith("catalina.")) { return true; } if (apache.startsWith("jasper.")) { return true; } if (apache.startsWith("tomcat.")) { return true; } if (apache.startsWith("el.")) { return true; } if (apache.startsWith("naming.")) { return true; } if (apache.startsWith("taglibs.standard.")) { return true; } if (apache.startsWith("openejb.")) { return !isWebAppEnrichment(apache.substring("openejb.".length())); } if (apache.startsWith("commons.")) { final String commons = apache.substring("commons.".length()); if (commons.startsWith("beanutils.")) { return isInServer(name); } if (commons.startsWith("cli.")) { return true; } if (commons.startsWith("codec.")) { return true; } if (commons.startsWith("collections.")) { return true; } if (commons.startsWith("dbcp.")) { return true; } if (commons.startsWith("dbcp2.")) { return true; } if (commons.startsWith("digester.")) { return true; } if (commons.startsWith("jocl.")) { return true; } if (commons.startsWith("lang.")) { return true; } if (commons.startsWith("lang3.")) { return true; } if (commons.startsWith("logging.")) { return false; } if (commons.startsWith("pool.")) { return true; } if (commons.startsWith("pool2.")) { return true; } if (commons.startsWith("net.") && SKIP_COMMONS_NET) { return true; } return false; } if (SKIP_MYFACES && apache.startsWith("myfaces.")) { final String myfaces = name.substring("myfaces.".length()); if (myfaces.startsWith("shared.")) { return true; } if (myfaces.startsWith("ee.")) { return true; } if (myfaces.startsWith("lifecycle.")) { return true; } if (myfaces.startsWith("context.")) { return true; } if (myfaces.startsWith("logging.")) { return true; } if (myfaces.startsWith("component.visit.") || myfaces.equals("component.ComponentResourceContainer")) { return true; } if (myfaces.startsWith("application.")) { return true; } if (myfaces.startsWith("config.")) { return true; } if (myfaces.startsWith("event.")) { return true; } if (myfaces.startsWith("resource.")) { return true; } if (myfaces.startsWith("el.")) { return true; } if (myfaces.startsWith("spi.")) { return true; } if (myfaces.startsWith("convert.")) { return true; } if (myfaces.startsWith("debug.")) { return true; } if (myfaces.startsWith("util.")) { return true; } if (myfaces.startsWith("view.")) { return true; } if (myfaces.equals("convert.ConverterUtils")) { return true; } if (myfaces.startsWith("renderkit.")) { final String renderkit = myfaces.substring("renderkit.".length()); if (renderkit.startsWith("html.Html")) { return true; } final char firstNextletter = renderkit.charAt(0); if (Character.isUpperCase(firstNextletter)) { return true; } return false; } if (myfaces.startsWith("taglib.")) { final String taglib = myfaces.substring("taglib.".length()); if (taglib.startsWith("html.Html")) { return true; } if (taglib.startsWith("core.")) { return true; } return false; } if (myfaces.startsWith("webapp.")) { final String webapp = myfaces.substring("webapp.".length()); if (webapp.startsWith("Faces")) { return true; } if (webapp.startsWith("Jsp")) { return true; } if (webapp.startsWith("Startup")) { return true; } if (webapp.equals("AbstractFacesInitializer")) { return true; } if (webapp.equals("MyFacesServlet")) { return true; } if (webapp.equals("ManagedBeanDestroyerListener")) { return true; } if (webapp.equals("WebConfigParamsLogger")) { return true; } return false; } return false; } if (apache.startsWith("activemq.")) { return SKIP_JMS && isInServer(name); } return false; } if (org.startsWith("hsqldb.") && SKIP_HSQLDB) { return true; } if (org.startsWith("codehaus.swizzle.")) { final String swizzle = org.substring("codehaus.swizzle.".length()); if (swizzle.startsWith("stream.")) { return true; } if (swizzle.startsWith("rss.")) { return true; } if (swizzle.startsWith("Grep.class") || swizzle.startsWith("Lexer.class")) { return true; } return false; } if (org.startsWith("w3c.dom.") || org.startsWith("xml.sax.")) { return isInJvm(name); } if (org.startsWith("eclipse.jdt.")) { return true; } return false; } if (name.startsWith("com.")) { final String sub = name.substring("com.".length()); if (sub.startsWith("sun.")) { return !name.startsWith("sun.mail.") && isInJvm(name); } if (sub.startsWith("oracle.")) { return true; } } if (name.startsWith("jdk.")) { return true; } if (name.startsWith("serp.bytecode.")) { return true; } return false; } URLClassLoaderFirst(final URL[] urls, final ClassLoader parent); static void reloadConfig(); @Override Class<?> loadClass(final String name, final boolean resolve); static boolean shouldDelegateToTheContainer(final ClassLoader loader, final String name); Class<?> findAlreadyLoadedClass(final String name); Class<?> loadInternal(final String name, final boolean resolve); static boolean canBeLoadedFromSystem(final String name); static boolean shouldSkip(final String name); static boolean shouldSkipJsf(final ClassLoader loader, final String name); @Override Enumeration<URL> getResources(final String name); static boolean isFilterableResource(final String name); static boolean shouldSkipSlf4j(final ClassLoader loader, final String name); static Enumeration<URL> filterResources(final String name, final Enumeration<URL> result); }
URLClassLoaderFirst extends URLClassLoader { public static boolean shouldSkip(final String name) { if (name == null) { return false; } for (final String prefix : FORCED_SKIP) { if (name.startsWith(prefix)) { return true; } } for (final String prefix : FORCED_LOAD) { if (name.startsWith(prefix)) { return false; } } if (name.startsWith("java.")) { return true; } if (name.startsWith("javax.faces.")) { return false; } if (name.startsWith("javax.mail.")) { return false; } if (name.startsWith("javax.") || name.startsWith("jakarta.")) { return isInServer(name); } if (name.startsWith("sun.")) { return isInJvm(name); } if (name.startsWith("javax.servlet.jsp.jstl")) { return false; } if (name.startsWith("org.")) { final String org = name.substring("org.".length()); if (org.startsWith("apache.")) { final String apache = org.substring("apache.".length()); if (apache.startsWith("webbeans.jsf")) { return false; } if (apache.startsWith("tomee.mojarra.")) { return false; } if (apache.startsWith("bval.")) { return true; } if (apache.startsWith("openjpa.")) { return true; } if (apache.startsWith("xbean.")) { return !apache.substring("xbean.".length()).startsWith("spring"); } if (apache.startsWith("geronimo.")) { return true; } if (apache.startsWith("coyote.")) { return true; } if (apache.startsWith("webbeans.")) { return true; } if (apache.startsWith("log4j.") && SKIP_LOG4J) { return true; } if (apache.startsWith("catalina.")) { return true; } if (apache.startsWith("jasper.")) { return true; } if (apache.startsWith("tomcat.")) { return true; } if (apache.startsWith("el.")) { return true; } if (apache.startsWith("naming.")) { return true; } if (apache.startsWith("taglibs.standard.")) { return true; } if (apache.startsWith("openejb.")) { return !isWebAppEnrichment(apache.substring("openejb.".length())); } if (apache.startsWith("commons.")) { final String commons = apache.substring("commons.".length()); if (commons.startsWith("beanutils.")) { return isInServer(name); } if (commons.startsWith("cli.")) { return true; } if (commons.startsWith("codec.")) { return true; } if (commons.startsWith("collections.")) { return true; } if (commons.startsWith("dbcp.")) { return true; } if (commons.startsWith("dbcp2.")) { return true; } if (commons.startsWith("digester.")) { return true; } if (commons.startsWith("jocl.")) { return true; } if (commons.startsWith("lang.")) { return true; } if (commons.startsWith("lang3.")) { return true; } if (commons.startsWith("logging.")) { return false; } if (commons.startsWith("pool.")) { return true; } if (commons.startsWith("pool2.")) { return true; } if (commons.startsWith("net.") && SKIP_COMMONS_NET) { return true; } return false; } if (SKIP_MYFACES && apache.startsWith("myfaces.")) { final String myfaces = name.substring("myfaces.".length()); if (myfaces.startsWith("shared.")) { return true; } if (myfaces.startsWith("ee.")) { return true; } if (myfaces.startsWith("lifecycle.")) { return true; } if (myfaces.startsWith("context.")) { return true; } if (myfaces.startsWith("logging.")) { return true; } if (myfaces.startsWith("component.visit.") || myfaces.equals("component.ComponentResourceContainer")) { return true; } if (myfaces.startsWith("application.")) { return true; } if (myfaces.startsWith("config.")) { return true; } if (myfaces.startsWith("event.")) { return true; } if (myfaces.startsWith("resource.")) { return true; } if (myfaces.startsWith("el.")) { return true; } if (myfaces.startsWith("spi.")) { return true; } if (myfaces.startsWith("convert.")) { return true; } if (myfaces.startsWith("debug.")) { return true; } if (myfaces.startsWith("util.")) { return true; } if (myfaces.startsWith("view.")) { return true; } if (myfaces.equals("convert.ConverterUtils")) { return true; } if (myfaces.startsWith("renderkit.")) { final String renderkit = myfaces.substring("renderkit.".length()); if (renderkit.startsWith("html.Html")) { return true; } final char firstNextletter = renderkit.charAt(0); if (Character.isUpperCase(firstNextletter)) { return true; } return false; } if (myfaces.startsWith("taglib.")) { final String taglib = myfaces.substring("taglib.".length()); if (taglib.startsWith("html.Html")) { return true; } if (taglib.startsWith("core.")) { return true; } return false; } if (myfaces.startsWith("webapp.")) { final String webapp = myfaces.substring("webapp.".length()); if (webapp.startsWith("Faces")) { return true; } if (webapp.startsWith("Jsp")) { return true; } if (webapp.startsWith("Startup")) { return true; } if (webapp.equals("AbstractFacesInitializer")) { return true; } if (webapp.equals("MyFacesServlet")) { return true; } if (webapp.equals("ManagedBeanDestroyerListener")) { return true; } if (webapp.equals("WebConfigParamsLogger")) { return true; } return false; } return false; } if (apache.startsWith("activemq.")) { return SKIP_JMS && isInServer(name); } return false; } if (org.startsWith("hsqldb.") && SKIP_HSQLDB) { return true; } if (org.startsWith("codehaus.swizzle.")) { final String swizzle = org.substring("codehaus.swizzle.".length()); if (swizzle.startsWith("stream.")) { return true; } if (swizzle.startsWith("rss.")) { return true; } if (swizzle.startsWith("Grep.class") || swizzle.startsWith("Lexer.class")) { return true; } return false; } if (org.startsWith("w3c.dom.") || org.startsWith("xml.sax.")) { return isInJvm(name); } if (org.startsWith("eclipse.jdt.")) { return true; } return false; } if (name.startsWith("com.")) { final String sub = name.substring("com.".length()); if (sub.startsWith("sun.")) { return !name.startsWith("sun.mail.") && isInJvm(name); } if (sub.startsWith("oracle.")) { return true; } } if (name.startsWith("jdk.")) { return true; } if (name.startsWith("serp.bytecode.")) { return true; } return false; } URLClassLoaderFirst(final URL[] urls, final ClassLoader parent); static void reloadConfig(); @Override Class<?> loadClass(final String name, final boolean resolve); static boolean shouldDelegateToTheContainer(final ClassLoader loader, final String name); Class<?> findAlreadyLoadedClass(final String name); Class<?> loadInternal(final String name, final boolean resolve); static boolean canBeLoadedFromSystem(final String name); static boolean shouldSkip(final String name); static boolean shouldSkipJsf(final ClassLoader loader, final String name); @Override Enumeration<URL> getResources(final String name); static boolean isFilterableResource(final String name); static boolean shouldSkipSlf4j(final ClassLoader loader, final String name); static Enumeration<URL> filterResources(final String name, final Enumeration<URL> result); static final Collection<String> FORCED_SKIP; static final Collection<String> FORCED_LOAD; static final Collection<String> FILTERABLE_RESOURCES; static final String SLF4J_BINDER_CLASS; static final ClassLoader SYSTEM_CLASS_LOADER; }