static void denyClassNotFound(ClassLoader limbusClassloader, String className) throws LimbusClasspathException { try { getClass(limbusClassloader, className); } catch (ClassNotFoundException e) { throw new LimbusClasspathException(String.format("The class %s is not deployed on this classpath.", className), e); } }
static boolean isLimbusPlugin(ClassLoader limbusClassloader, String className) { Lang.denyNull("Classloader", limbusClassloader); Lang.denyNull("Classname", className); Class<?> clazz; try { // schuettec - 04.10.2016 : In the past we used Class.forName here (see next code line). This suffers from the // effect that classes loaded this way kept in memory for ever. // clazz = Class.forName(className, false, limbusClassloader); // schuettec - 06.10.2016 : Another thing to notice is, that here is not LimbusContextAction used to load the // class. This is because we do not initialize the class. We simply load it to know the type. No plugin code is // running here, so not LimbusContextAction is needed. clazz = getClass(limbusClassloader, className); return LimbusPlugin.class.isAssignableFrom(clazz) && !LimbusPlugin.class.equals(clazz) && !clazz.isInterface() && !Modifier.isAbstract(clazz.getModifiers()); } catch (Throwable e) { // Ignore throwables is the only way to go here: We want to analyze classes for their types. This means the // classloader has to load them. He often will try to load classes that are not available in the classpath. Often // libraries have references to classes that are provided at runtime only if a specific feature is used at // runtime. Those optional classes will cause NoClassDefFoundErrors at this point. return false; } }