users@jaxb.java.net

"impossible" exception thrown from RI

From: Kenny MacLeod <kennym_at_kizoom.com>
Date: Wed, 08 Nov 2006 13:57:17 +0000

I just came across the RI throwing a java.lang.InternalError when
setting up the context.

The exception is thrown from RuntimeInlineAnnotationReader line 99,
which is amusingly commented as "impossible".

The root cause was that I had used xjc:javaType in the binding
customisation to bind schema types to some custom java types, but when
I'd used the generated bindings in my application, I'd forgotten to
include the JAR which contained my custom bound types.

So the RI failed because it couldn't find the type, which was wrapped in
an InvocationTargetException, which in turn was retrown as an InternalError.

Tricky one to diagnose, since InternalError doesn't have a getCause(),
so I had to use the debugger to trap the original before it was rethrown.

Can the RI be changed to handle this more gracefully?