users@jaxb.java.net

Re: [Fwd: Your Report: xsd using substitution groups causes marshaller to hang]

From: Ed Mooney <Ed.Mooney_at_sun.com>
Date: Fri, 11 Jul 2003 10:41:53 -0400

Hi Petra,

I'm able to duplicate your result. Thanks for bringing it to our
attention. I'll enter a report internally and ask that it be visible
throught BugParade.

Regards,
--
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho
Petra Malik wrote:
> Hi,
>
> when using substitution groups and the extension option, it seems to happen
> that the marshaller hangs.
>
> I filed a bug some time ago, but I did not get an answer so far.
> Since I get this problem quite often and with different schemas,
> I am wondering now whether it is really a bug or whether I do something
> wrong.
>
> Could somebody check whether he/she also has this problem?
> A attached my bugreport below.
>
> Thanks,
> Petra
>
>
> -------- Original Message --------
> Subject: Your Report: xsd using substitution groups causes marshaller to
> hang
> Date: Tue, 24 Jun 2003 21:44:34 -0600 (MDT)
> From: IncidentDaemon_at_sun.com <IncidentDaemon_at_sun.com>
> To: petra_at_cs.waikato.ac.nz
>
>
>
> ************************************************
> Your report has been assigned an internal review ID of: 189200
>
> 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: Tue Jun 24 21:44:32 MDT 2003
> type:        bug
> cust_name:   Petra Malik
> cust_email:  petra_at_cs.waikato.ac.nz
> jdcid:
> status:      Waiting
> category:    jaxb-xsd
> subcategory: runtime
> company:     University of Waikato
> release:     fcs1.0
> hardware:    x86
> OSversion:   Linux
> priority:    4
> synopsis:    xsd using substitution groups causes marshaller to hang
> description: FULL PRODUCT VERSION :
> java version "1.4.1_02"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
> Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
>
>
>
> FULL OS VERSION :
> Linux i686 (Slackware 8.0.0)
>
> A DESCRIPTION OF THE PROBLEM :
> Jaxb doesn't stop marshalling.
>
> STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
> xjc.sh -extension test.xsd -p jaxb
> Compile (see Test.java below) and Run
>
>
> EXPECTED VERSUS ACTUAL BEHAVIOR :
> EXPECTED -
> Marshalles the given XML file to output.
> ACTUAL -
> Marshall:
>
> (doesn't stop)
>
>
> ERROR MESSAGES/STACK TRACES THAT OCCUR :
> none, just hangs
>
> REPRODUCIBILITY :
> This bug can be reproduced always.
>
> ---------- BEGIN SOURCE ----------
> Schema file test.xsd:
> ----------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:Z="http://www.cs.waikato.ac.nz"
> targetNamespace="http://www.cs.waikato.ac.nz"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> version="1.0">
>
>  <xs:element name="Spec">
>    <xs:complexType>
>      <xs:choice minOccurs="0" maxOccurs="unbounded">
>        <xs:element name="SchText" type="Z:SchText"/>
>      </xs:choice>
>    </xs:complexType>
>  </xs:element>
>
>  <xs:element name="Decl" type="Z:DeclType" abstract="true"/>
>  <xs:element type="Z:VarDeclType" name="VarDecl"
> substitutionGroup="Z:Decl"/>
>
>  <xs:element name="Expr" type="Z:ExprType" abstract="true"/>
>  <xs:element type="Z:RefExprType" name="RefExpr"
> substitutionGroup="Z:Expr"/>
>
>  <xs:complexType name="SchText">
>        <xs:sequence>
>          <xs:element ref="Z:Decl" minOccurs="0" maxOccurs="unbounded"/>
>        </xs:sequence>
>  </xs:complexType>
>
>  <xs:complexType name="DeclType"/>
>  <xs:complexType name="RefName">
>  </xs:complexType>
>  <xs:complexType name="ExprType"/>
>  <xs:complexType name="VarDeclType">
>    <xs:complexContent>
>      <xs:extension base="Z:DeclType">
>        <xs:sequence>
>          <xs:element ref="Z:Expr"/>
>        </xs:sequence>
>      </xs:extension>
>    </xs:complexContent>
>  </xs:complexType>
>  <xs:complexType name="RefExprType">
>    <xs:complexContent>
>      <xs:extension base="Z:ExprType">
>        <xs:sequence>
>          <xs:element ref="Z:Expr" minOccurs="0" maxOccurs="unbounded"/>
>        </xs:sequence>
>      </xs:extension>
>    </xs:complexContent>
>  </xs:complexType>
> </xs:schema>
> ---------------------------------------------------------------------------
>
> XML file test.xml:
>
> ----------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com) by Mark
> Utting (The University of Waikato) -->
> <Spec xmlns="http://www.cs.waikato.ac.nz">
>        <SchText>
>                <VarDecl>
>                        <RefExpr/>
>                </VarDecl>
>        </SchText>
> </Spec>
> ------------------------------------------------------------------------------
>
>
> Test.java:
>
> import java.io.FileInputStream;
> import java.io.IOException;
>
> import javax.xml.bind.JAXBContext;
> import javax.xml.bind.JAXBException;
> import javax.xml.bind.Unmarshaller;
> import javax.xml.bind.Marshaller;
>
> import jaxb.*;
>
> public class Test {
>  public static void main( String[] args ) {
>    try {
>      // create a JAXBContext capable of handling classes generated
>      JAXBContext jaxcontext = JAXBContext.newInstance("jaxb");
>
>      // create an Unmarshaller
>      Unmarshaller unmarshaller = jaxcontext.createUnmarshaller();
>
>      // unmarshal
>      Object o = unmarshaller.unmarshal(new FileInputStream("test.xml"));
>
>      System.out.println("Marshall:");
>      Marshaller m = jaxcontext.createMarshaller();
>      m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
>      m.marshal( o, System.out );
>
>    } catch( Exception e ) {
>      e.printStackTrace();
>    }
>  }
> }
>
> ---------- END SOURCE ----------
> workaround:
> comments:    (company - University of Waikato , email -
> petra_at_cs.waikato.ac.nz)