diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java index b2506904df2ebe0b3dbbacf376af0548d09060be..574bd8986b921432d8767112f109162ae7f1f75e 100644 --- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java +++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java @@ -83,6 +83,7 @@ import java.lang.UnsatisfiedLinkError; import java.lang.ExceptionInInitializerError; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Modifier; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; @@ -1482,14 +1483,7 @@ public class AServProtocolManager implements Service { public boolean implementsInterface( String classname, Class<?> tosubclass ) { try { - // This was used to ban classes with weird behaviour - // This is not needed anymore (kept as an example) - /* - if ( classname.equals("org.apache.xalan.extensions.ExtensionHandlerGeneral") || - classname.equals("org.apache.log4j.net.ZeroConfSupport") - ) { - throw new ClassNotFoundException( "Classes breaking this work" ); - }*/ + // JE2015: I guess that this was here because we used to instantiate the classes? // This is a little crazy but at least save PermGem // These are our largest libraries, but others may be to ban // Hope that they do not implement any of our interfaces @@ -1509,22 +1503,12 @@ public class AServProtocolManager implements Service { || classname.startsWith( "org.apache.html" ) || classname.startsWith( "org.apache.wml" ) ) return false; - // JE: Here there is a bug that is that it is not possible - // to have ALL interfaces with this function!!! - // This is really stupid but that's life - // So it is compulsory that AlignmentProcess be declared - // as implemented Class<?> cl = Class.forName(classname); + int mod = cl.getModifiers(); // It is possible to suppress here abstract classes by: - if ( java.lang.reflect.Modifier.isAbstract( cl.getModifiers() ) ) return false; - Class[] interfaces = cl.getInterfaces(); - for ( int i=interfaces.length-1; i >= 0 ; i-- ){ - if ( interfaces[i] == tosubclass ) { - //logger.trace(" -j-> {}", classname); - return true; - } - //logger.trace(" I> {}", interfaces[i] ); - } + if ( !Modifier.isAbstract( mod ) + && !Modifier.isInterface( mod ) + && tosubclass.isAssignableFrom( cl ) ) return true; // Not one of our classes } catch ( ExceptionInInitializerError eiie ) { } catch ( NoClassDefFoundError ncdex ) {