Hi.
I have a strange problem using Java 1.8. Everything works great for Karaf 2.4.0
and Karaf 4.0.0-SNAPSHOT, except the following code:
public final class ExceptionProblem
{
public static void testException()
throws Exception
{
throw new ProblematicException( new RuntimeException() );
}
public static final class ProblematicException
extends Exception
{
public ProblematicException( final Throwable cause )
{
super( "Exception message!", cause, false, false );
}
}
}
Here it's using a protected constructor in RuntimeException with <String,
Throwable, Boolean, Boolean> signature. In Karaf 2.4.0 and Karaf 4.0.0-SNAPSHOT
(and also Karaf 3.0.1 with newer ASM) it fails with
"java.lang.NoSuchMethodError: java.lang.Exception: method
<init>(Ljava/lang/String;Ljava/lang/Throwable;ZZ)V not found" exception.
I have ensured that Java 8 is running so it's not that it's running a different
VM. Have also tried Felix 4.4.1 directly and here it works. Seems to me that
this is a Karaf (or related Karaf bundles) problem. I could just use another
constructor here, but this code is actually deep inside Nashorn so it's no
option to actually change the code.
Also, this is actually not a problem if it extends Throwable instead of
Exception.
Anyone that can give me some pointers to where to look or tweek?
BR,
Sten Roger