users@jaxb.java.net

NullPointerException using jaxb:javaType

From: Greg T Robertson <gregrob_at_us.ibm.com>
Date: Tue, 6 Jan 2004 12:16:02 -0500

I am currently using the version of Jaxb that shipped with JWSDP 1.3. I
have previously used global bindings to override the normal
printCalendar/parseCalendar methods for the java type java.util.Calendar
using the following entry in the bindings file:

       <jxb:javaType name="java.util.Calendar"
                  xmlType="someDateField"
                  parseMethod="util.XMLUtil.parseCalendar"
                  printMethod="util.XMLUtil.printCalendar" />

And this works fine. Now I need to do something similar for decimals. So
I created this entry

        <jxb:javaType name="java.math.BigDecimal"
                    xmlType="someDecimalType"
                  parseMethod="util.XMLUtil.parseDecimal"
                  printMethod="util.XMLUtil.printDecimal" />

When I go to generate classes I get this error:

java.lang.NullPointerException
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder._getBindInfoReadOnly(BG
MBuilder.java:392)
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder.getOrCreateBindInfo(BGM
Builder.java:349)
        at
com.sun.tools.xjc.reader.xmlschema.bindinfo.BIGlobalBinding.dispatchG
lobalConversions(BIGlobalBinding.java:193)
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder.promoteGlobalBindings(B
GMBuilder.java:172)
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder.<init>(BGMBuilder.java:
326)
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:8
0)
        at
com.sun.tools.xjc.GrammarLoader.annotateXMLSchema(GrammarLoader.java:
424)
        at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:130)
        at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:79)
        at com.sun.tools.xjc.XJCTask._doXJC(XJCTask.java:331)
        at com.sun.tools.xjc.XJCTask.doXJC(XJCTask.java:283)
        at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:227)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

Total time: 22 seconds
java.lang.NullPointerException
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder._getBindInfoReadOnly(BG
MBuilder.java:392)
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder.getOrCreateBindInfo(BGM
Builder.java:349)
        at
com.sun.tools.xjc.reader.xmlschema.bindinfo.BIGlobalBinding.dispatchG
lobalConversions(BIGlobalBinding.java:193)
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder.promoteGlobalBindings(B
GMBuilder.java:172)
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder.<init>(BGMBuilder.java:
326)
        at
com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:8
0)
        at
com.sun.tools.xjc.GrammarLoader.annotateXMLSchema(GrammarLoader.java:
424)
        at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:130)
        at com.sun.tools.xjc.GrammarLoader.load(GrammarLoader.java:79)
        at com.sun.tools.xjc.XJCTask._doXJC(XJCTask.java:331)
        at com.sun.tools.xjc.XJCTask.doXJC(XJCTask.java:283)
        at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:227)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

I have verified that the methods exist and are the correct signatures (
public static String printDecimal(java.math.BigDecimal value) and public
static java.math.BigDecimal parseDecimal(String value) ). I also
temporarily removed the type for Calendar to see if it was an issue with
multiple types, and it is not. It definitely seems to be related to the
entry for BigDecimal. Has anyone seen this behaviour before?


Thanks,

Greg T. Robertson


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net