users@jaxb.java.net

Re: NPE with Messages.format

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Tue, 06 Dec 2005 10:05:57 -0800

Dan Diephouse wrote:
> The Messages.format method depends on classloaders implementing
> Class.getPackage(), which isn't always the case (it can return null, see
> the javadocs). So while building you can get an exception like:
>
> java.lang.NullPointerException
> at com.sun.tools.xjc.Messages.format(Messages.java:33)
> at com.sun.tools.xjc.Driver.getBuildID(Driver.java:351)
> at com.sun.tools.xjc.XJC2Task.execute(XJC2Task.java:308)
> at org.apache.tools.ant.Task.perform(Task.java:341)
>
> I've attached a patch which remedies the problem. Cheers,
> - Dan

Thanks for a patch. The problem is that there are a large number of
Messages classes all over in XJC.

I think what I should really do is to rename MessageBundle.properties
back to Messages.properties, so that I can simply do:

ResourceBundle.getBundle(Messages.class..getName()+".MessageBundle").getString

> PS - Is someone still going to upload the JAXB jars?

Yes! It's on our TODO list...

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com