users@jaxb.java.net

Re: factory.createType() throws JAXBException

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 25 Aug 2005 15:59:49 -0700

Roman Seidl wrote:
> the xjc of jaxb 1 creates a factory that throws JAXBException though it
> only calls new Type() on the Type wanted ant the Constructor does not do
> so. So it is only doe to the Spec that it does so.

Right.

> Is there a way to change the Signiture if the Factory so that it does
> not throw JAXBException?

Not right now, but it's relatively easy addition. It just makes us bit
nervous to add a new switch to make it non-compliant to the spec, though.

If you'd be willing to be non-compliant, I wonder if you'd be willing to
call "new FooImpl()" directly instead of "new ObjectFactory().createFoo()".

In that way you can get rid of the ObjectFactory construction
altogether, no more try/catch block, and we don't have to add a switch
to XJC 1 :-)

In 2.0, ObjectFactory no longer throws a checked exception.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com