db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vemund Ostgaard <Vemund.Ostga...@Sun.COM>
Subject Problem with addSuiteByReflection() on phoneME advanced platform
Date Mon, 10 Mar 2008 17:16:16 GMT
The past few days it has not been possible to run suites.All on phoneME 
advanced, junit will just exit with an InvocationTargetException when 
trying to invoke the suites.All.suite() method. Unwrapping the exception 
shows that the underlying reason is a NoClassDefFoundError from the 
invoke() call in AllPackages.addSuiteByReflection() when trying to load 
the new JMX suite.

Now, this suite is compiled into 1.5 classfiles, so the Class.forName() 
call before the invoke() should have failed with 
UnsupportedClassVersionError. It does fail as expected when running with 
jdk 1.4, but on phoneME advanced it does not, I think it has to be a bug 
in phoneME advanced.

Now, I was pondering if it would make sense to also catch 
InvocationTargetException from the try block below, unwrap it and see if 
it is an instance of LinkageError and if so skip the testsuite. This 
would make it possible to run the tests on phoneME advanced, despite the 
bug. Any reason why this would be a bad idea?

private static Test addSuiteByReflection(String className) throws Exception
    {
        try {
            Class clz = Class.forName(className);
            
            Method sm = clz.getMethod("suite", null);
                  
            return (Test) sm.invoke(null, null);
        } catch (LinkageError  e) {
            return new TestSuite("SKIPPED: " + className + " - " +
                    e.getMessage());
        }
       
    }

Mime
View raw message