users@jaxb.java.net

FW: Your Report (Review ID: 227897) - NullPointerException runnin g xjc version 1.0.2

From: Lee Breisacher <LBreisacher_at_seagullsw.com>
Date: Wed, 26 Nov 2003 03:04:35 -0500

fyi... I have an xsd/xjb combination that crashes xjc. See bug report
below..

Lee


-----Original Message-----
From: IncidentDaemon_at_sun.com [mailto:IncidentDaemon_at_sun.com]
Sent: Tuesday, November 25, 2003 11:37 PM
To: lbreisacher_at_seagullsw.com
Subject: Your Report (Review ID: 227897) - NullPointerException running
xjc version 1.0.2


************************************************
Your report has been assigned an internal review ID of: 227897

This review ID is NOT visible on the "Java Developer Connection" (JDC).

We greatly appreciate your interest in improving the quality
of Java(tm) Technology from Sun Microsystems.

Please be aware that the large volume of reports we receive
sometimes prevents us from responding individually to each
message.

We currently have a three week response time for responding to
Bug Reports. If the information is determined to be a new bug,
or a duplicate of a known bug, you will receive a followup email
containing a seven digit bug number. You may search for this bug
number on the "Java Developer Connection" (JDC) at this URL:
http://developer.java.sun.com/developer/bugParade/index.html.

If you just reported an issue that could have a major
impact on your project and you require a response,
please consider purchasing one of the support offerings
at this URL:
    http://java.sun.com/support/index.html


---------------------------------------------------------------


dateCreated: Wed Nov 26 00:36:29 MST 2003
type: bug
cust_name: Lee Breisacher
cust_email: lbreisacher_at_seagullsw.com
jdcid:
status: Waiting
category: jaxb-xsd
subcategory: compiler
company: SEAGULL Software Systems
release: 1.0.1
hardware: x86
OSversion: win_xp
priority: 4
synopsis: NullPointerException running xjc version 1.0.2
description: FULL PRODUCT VERSION :
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
I'm running jaxb 1.0.2, not 1.0.1 (the only choice on the first page of the
bug reporting pages was 1.0.1!). I also tried it with the latest build
posted on java.net (jaxb-ri-20031125).

A DESCRIPTION OF THE PROBLEM :
With a particular xsd and xjb (see below), running xjc crashes with a
NullPointerException:

parsing a schema...
compiling a schema...
Exception in thread "main" java.lang.NullPointerException
        at
com.sun.tools.xjc.generator.marshaller.MarshallerGenerator.generateMethodSke
leton(MarshallerGenerator.java:189)
        at
com.sun.tools.xjc.generator.marshaller.MarshallerGenerator.generate(Marshall
erGenerator.java:88)
        at
com.sun.tools.xjc.generator.marshaller.MarshallerGenerator.<init>(Marshaller
Generator.java:75)
        at
com.sun.tools.xjc.generator.marshaller.MarshallerGenerator.generate(Marshall
erGenerator.java:55)
        at com.sun.tools.xjc.Driver.generateCode(Driver.java:370)
        at com.sun.tools.xjc.Driver.run(Driver.java:215)
        at com.sun.tools.xjc.Driver._main(Driver.java:80)
        at com.sun.tools.xjc.Driver.access$000(Driver.java:46)
        at com.sun.tools.xjc.Driver$1.run(Driver.java:60)


Note that this same xsd and xjb compile just fine using jaxb 1.0.1.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run this xjc line:
        xjc -b bindings.xjb configuration.xsd

with these files:

configuration.xsd:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
        <xs:element name="configuration">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="description"
type="DescriptionType" minOccurs="0"/>
                                <xs:element ref="property" minOccurs="0"
maxOccurs="unbounded"/>
                                <xs:element ref="plug-in"/>
                        </xs:sequence>
                        <xs:attribute name="version" type="xs:float"
use="required" fixed="1.0"/>
                        <xs:attribute name="name" type="xs:string"
use="required"/>
                        <xs:attribute name="enabled" type="xs:boolean"
use="optional" default="true"/>
                </xs:complexType>
        </xs:element>
        <xs:element name="property">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="description"
type="DescriptionType" minOccurs="0"/>
                        </xs:sequence>
                        <xs:attribute name="key" type="xs:string"
use="required"/>
                        <xs:attribute name="value" type="xs:string"
use="required"/>
                        <xs:attribute name="enabled" type="xs:boolean"
use="optional" default="true"/>
                </xs:complexType>
        </xs:element>
        <xs:simpleType name="DescriptionType">
                <xs:restriction base="xs:string"/>
        </xs:simpleType>
        <xs:element name="plug-in">
                <xs:complexType>
                        <xs:attribute name="type" type="xs:string"
use="required"/>
                        <xs:attribute name="value" type="xs:string"
use="required"/>
                </xs:complexType>
        </xs:element>
</xs:schema>



bindings.xjb:

<?xml version="1.0" encoding="UTF-8"?>

<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <jxb:bindings schemaLocation="configuration.xsd" node="/xs:schema">
        <jxb:globalBindings collectionType="indexed"
fixedAttributeAsConstantProperty="true" generateIsSetMethod="true"/>
        <jxb:schemaBindings>
            <jxb:nameXmlTransform>
                <jxb:elementName suffix="Binding"/>
            </jxb:nameXmlTransform>
        </jxb:schemaBindings>
    </jxb:bindings>
</jxb:bindings>


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
not a crash..
ACTUAL -
see Description above

ERROR MESSAGES/STACK TRACES THAT OCCUR :
see Description above - full stack trace there.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
see steps to reproduce above.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I did discover by trial and error that if I remove this attribute:
          fixedAttributeAsConstantProperty="true"
from bindings.xjb, then xjc works fine without crashing.
workaround:
comments: (company - SEAGULL Software Systems , email -
lbreisacher_at_seagullsw.com)