Does XJC in 1.0.6 support -nv flag (as it does in 2.0)? I
had this problem on maxOccurs=32667 and using this flag
(which suppresses validation) we have been able to
circumvent the problem.
Kirill
--- Aleksei Valikov <valikov_at_gmx.net> wrote:
> Hi.
>
> This concerns JAXB 1.0.6.
>
> A Hyperjaxb user send me a bug report about
> StackOverflowError with his schema.
> I've investigated and it seems to be a problem with XJC.
>
> In his schema (attached) there are several elements with
> large maxOccurs (like
> maxOccurs="2000").
>
> The problem is that elements with large maxOccurs produce
> relatively large trees
> - and when walked, they also produce deep recursion. This
> causes SOE.
>
> From xjc code it appears that OccurenceExp is often
> processed as a simple
> expression, where it could be processed as occurence. In
> many places tree
> walking is simply unnecessary, since the bottom
> expression (itemExp) is know as
> well as minOccurs and maxOccurs. Therefor considering
> OccurenceExp in some
> places could remove the unnecessary recursion.
>
> I have identified four of such locations. I'm listing
> with my corrections:
>
> 1.
>
DefaultParticleBinder.NameCollisionChecker.readSuperClass.
>
> public void onOther(OtherExp exp) {
>
> if(exp instanceof OccurrenceExp)
> {
> ((OccurrenceExp)
> exp).itemExp.visit(this);
> return;
> }
> if(exp instanceof FieldItem) {
>
> occupiedLabels.put(((FieldItem)exp).name,exp);
> return;
> }
> if(exp instanceof IgnoreItem) {
> return;
> }
> exp.exp.visit(this);
> }
>
> 2. AGMFragmentBuilder.findSuperClass.
>
> parent.exp.visit(new BGMWalker() {
> private boolean inSuper;
> private final Set visitedExps = new
> HashSet(); // inifinite
> recursion control
>
>
>
> public void onOther(OtherExp exp) {
> if (exp instanceof OccurrenceExp)
> {
> ((OccurrenceExp)
> exp).itemExp.visit(this);
> return;
>
> }
> super.onOther(exp);
> }
> public void onElement(ElementExp exp) {
> if( visitedExps.add(exp) )
> super.onElement(exp);
> }
> public Object onClass(ClassItem item) {
> if(inSuper)
> result[0] = item;
> return null;
> }
>
> public Object onSuper(SuperClassItem item) {
> inSuper = true;
> visitedExps.clear();
> item.exp.visit(this);
> inSuper = false;
> return null;
> }
> });
>
> 3. RelationNormalizer.Pass1.onOther:
> public Expression onOther( OtherExp exp ) {
>
> // if it's not a java item,
> // simply recurse its contents.
> if(!(exp instanceof JavaItem)) {
> // is this OK? looks potentially
> dangaerous
> // when this OtherExp is shared because
> // the modification can depend on the
> context.
>
> // but this is necessary to preserve
> OccurrenceExp
> if (exp instanceof OccurrenceExp)
> {
> OccurrenceExp oexp = (OccurrenceExp) exp;
> Expression p;
> if (oexp.minOccurs == 0)
> {
> p = pool.createZeroOrMore(oexp.itemExp.visit(this));
> }
> else
> {
> p = pool.createOneOrMore(oexp.itemExp.visit(this));
> }
> multiplicity = new Multiplicity(oexp.minOccurs,
> oexp.maxOccurs);
> return p;
> }
> else
> {
> exp.exp = exp.exp.visit(this);
> return exp;
> }
> }
>
> ....
>
> 4. Obviously somewhere in marshaller/validator
> generation, an exception appears
> during serialization of the BGM tree. I have not
> identified exactly where, I've
> simply disabled validation and validation marshaller
> generation.
>
> I don't want to commit my changes since I'm not 100% sure
> that they're fine. I'd
> like someone from the JAXB group to recheck them. Thank
> you!
>
> Bye.
> /lexi
> > <jaxb:bindings
> version="1.0"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> jaxb:extensionBindingPrefixes="xjc">
>
> <jaxb:bindings schemaLocation="CoreMain_v1.2.0.xsd"
> node="/xs:schema">
> <jaxb:globalBindings
> fixedAttributeAsConstantProperty="true"
> typesafeEnumBase="xs:string"
> typesafeEnumMemberName="generateName"
> generateIsSetMethod="true">
> <xjc:noValidator />
> <xjc:noValidatingUnmarshaller />
> </jaxb:globalBindings>
>
> <jaxb:schemaBindings>
> <jaxb:nameXmlTransform>
> <jaxb:elementName suffix="Element"/>
> </jaxb:nameXmlTransform>
> </jaxb:schemaBindings>
> </jaxb:bindings>
> </jaxb:bindings>
> > <?xml version="1.0" encoding="utf-8"?>
> <!-- edited with XMLSpy v2006 U (http://www.altova.com)
> by Bruce Marton (AACRAO SPEEDE) -->
> <!-- edited with XMLSPY v2004 rel. 3 U
> (http://www.xmlspy.com) by pheaa (Pennsylvania Higher
> Education Association) -->
> <!-- edited with XMLSPY v2004 rel. 3 U
> (http://www.xmlspy.com) by Jeffrey A Funck (Pennsylvania
> Higher Education Association) -->
> <!-- edited with XML Spy v4.4 U (http://www.xmlspy.com)
> by Bruce Robert Marton (The University of Texas at
> Austin) -->
> <!--=========================================-->
> <xs:schema
> targetNamespace="urn:org:pesc:core:CoreMain:v1.2.0"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:core="urn:org:pesc:core:CoreMain:v1.2.0"
> elementFormDefault="unqualified"
> attributeFormDefault="unqualified" version="v1.2.0">
>
>
<!--============================================================================-->
> <!--Name: CoreMain_v1.2.0.xsd (Formerly
> PESCBaseDataDictionary.xsd)-->
> <!--Version: 1.2.0-->
> <!--Date: 15-June-2006-->
> <!---->
> <!--ChangeCode Log:-->
> <!--1.0.0 07-MAY-2002 Initial Release based on
> BaseDictionaryVersion1.3.xls-->
> <!--1.0.1 07-MAY-2002 Added "Type" Suffix to all
> complex and simple types-->
> <!--1.0.2 09-MAY-2002 Minor updates - attributes,
> enumeration, etc. Added some Version1.3.1 changes.-->
> <!--1.1.0 10-MAY-2002 Added Contacts aggregate.-->
> <!--1.2.0 13-MAY-2002 Added Karl Van Neste work.-->
> <!--1.3.2 16-MAY-2002 Added remainder of
> BaseDictionaryVersion1.3.1 and 1.3.2 changes.-->
> <!--1.3.5 22-MAY-2002 Updated with
> BaseDictionaryVersion1.3.5.xls changes. Patterns,
> Attributes and Enumerations not verified.-->
> <!--1.3.7 01-JULY-2002 Bruce Marton - Preliminary
> changes based on review by ANSI X12 subcommittee A-->
> <!--1.3.8 16-JULY-2002 Bruce Marton - Rest of changes
> based on review by ANSI X12 subcommittee A-->
> <!--1.3.9 23-JULY-2002 Bruce Marton - Revised naming
> standards based on consultation with Department of Ed.
> Common Record. Cleaned up documentation. Reviewed
> aggreagation.-->
> <!--1.3.10 24-JULY-2002 Mike Rawlins - Changed name to
> Core, and other structural changes to more closely
> conform to XML Forum 3 tier architecture-->
> <!--00.01 26-July-2002 Bruce Marton - Minor revisions
> to initial version. Versioning scheme changed to reflect
> technical specification of a major and minor version
> number. This version is released for public comment
> period and is major version number 00. -->
> <!--00.01 28-February-2003 Bruce Marton - Interim
> version 7 complete-->
> <!--00.01 17-April-2003 Jeffrey Funck - Minor revisions
> for Commonline schemas-->
> <!--0002 23-May-2003 Mike Rawlins - Major changes and
> revisions-->
> <!--0003 29-May-2003 Jeffrey Funck - Updates from
> review and Commonline changes-->
> <!--0004 05-Feb-2004 Bruce Marton - Updates from
> AACRAO SPEEDE review.-->
> <!--0005 16-Mar-2004 Bruce Marton - Updates from PESC
> Change Control review.-->
> <!--0006 16-Apr-2004 Bruce Marton - Final Review and
> quality check-->
> <!--0099 26-May-2004 Bruce Marton - AACRAO SPEEDE
> review complete-->
> <!--v1.0.0 22-June-2004 Jeffrey Funck - Various changes
> as per PESC Control discussions-->
> <!--v1.0.1 06-Aug-2004 Jeffrey Funck - Various changes
> as per PESC Control discussions-->
> <!--v1.0.2 05-January-2005 Jeffrey A Funck - Various
> changes as approved by PESC Change Control Board-->
> <!-- Change # JAF20041122094000-->
> <!--v1.1.0 01-October-2005 Jeffrey A Funck - Added the
> value of 'Forwarded' to the Response Code Type-->
> <!-- Change # KS20050725090000-->
> <!--v1.2.0 15-February-2006 Bruce Marton - Final
> proposed changes for PESC High School Transcript as
> approved for public comment by PESC Change Control Board.
> -->
> <!-- Change # JAF20060221125700 (reviewed - JAF)-->
> <!--v1.2.0 07-June-2006 Jeffrey Funck - Revisions
> related to Public Comment period. -->
> <!-- Change # JAF20060221125700 -->
> <!--v1.2.0 15-June-2006 Jeffrey Funck - Add the
> enumeration 'G' to the FederalApplicationFormCodeType.
> -->
> <!-- Change # JAF20060328082200-->
> <!--v1.2.0 15-June-2006 Jeffrey Funck - Add the
> enumeration 'NonDegree' to the
> DegreeSeekingStatusCodeType. -->
> <!-- Change # KMS20060328082200-->
> <!--v1.2.0 13-July-2006 Jeffrey Funck - Added items
> required as part of new GRANT program. -->
> <!-- Change # RSW20060413095900-->
>
>
<!--============================================================================-->
> <!---->
> <!--=========================================-->
> <!--CoreComponent Types-->
> <!--=========================================-->
> <xs:complexType name="BorrowerType">
> <xs:sequence>
> <xs:element name="Person" type="core:PersonType"
> minOccurs="0" maxOccurs="unbounded"/>
> <xs:element name="Employment"
> type="core:EmploymentType" minOccurs="0"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="PersonType">
> <xs:sequence>
> <xs:element name="Birth" type="core:BirthType"
> maxOccurs="unbounded"/>
> <xs:element name="Name" type="core:NameType"
> maxOccurs="unbounded"/>
> <xs:element name="Contacts" type="core:ContactsType"
> minOccurs="0" maxOccurs="unbounded"/>
> <xs:element name="Gender" type="core:GenderType"
> minOccurs="0"/>
> <xs:element name="Marital" type="core:MaritalType"
> minOccurs="0" maxOccurs="unbounded"/>
> <xs:element name="RaceEthnicity"
> type="core:RaceEthnicityType" minOccurs="0"
> maxOccurs="unbounded"/>
> <xs:element name="Citizenship"
> type="core:CitizenshipType" minOccurs="0"
> maxOccurs="unbounded"/>
> <xs:element name="Residency" type="core:ResidencyType"
> minOccurs="0"/>
> <xs:element name="Deceased" type="core:DeceasedType"
> minOccurs="0"/>
> <xs:element name="EducationLevel"
> type="core:EducationLevelType" minOccurs="0"
> maxOccurs="unbounded"/>
> <xs:element name="Immigration"
> type="core:ImmigrationType" minOccurs="0"
> maxOccurs="unbounded"/>
> <xs:element name="Occupation"
> type="core:OccupationType" minOccurs="0"
> maxOccurs="unbounded"/>
> <xs:element name="ReligiousAffiliation"
> type="core:ReligiousAffiliationType" minOccurs="0"
> maxOccurs="unbounded"/>
> <xs:element name="PrivacyRestriction"
> type="core:PrivacyRestrictionType" minOccurs="0"
> maxOccurs="unbounded"/>
> <xs:element name="NoteMessage"
> type="core:NoteMessageType" minOccurs="0"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="OrganizationType">
> <xs:sequence>
> <xs:group ref="core:OrganizationIDGroup"/>
> <xs:element name="OrganizationName"
> type="core:OrganizationNameType" minOccurs="0"
> maxOccurs="unbounded"/>
> <xs:element name="Contacts" type="core:ContactsType"
> minOccurs="0" maxOccurs="unbounded"/>
> <xs:element name="NoteMessage"
> type="core:NoteMessageType" minOccurs="0"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="TransmissionDataType">
> <xs:annotation>
> <xs:documentation>TransmissionData
> Type</xs:documentation>
> </xs:annotation>
> <xs:sequence>
> <xs:element name="DocumentID"
> type="core:DocumentIDType"/>
> <xs:element name="CreatedDateTime"
> type="core:CreatedDateTimeType"/>
> <xs:element name="TransmissionType"
> type="core:TransmissionTypeType"/>
> <xs:element name="DocumentType"
> type="core:DocumentTypeCodeType"/>
> <xs:element name="NoteMessage"
> type="core:NoteMessageType" minOccurs="0"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> <!--=========================================-->
> <!--AcademicRecord Types-->
> <!--=========================================-->
> <xs:complexType
> name="AdditionalStudentAchievementsType">
> <xs:sequence>
> <xs:element name="Requirement" type="core:RAPType"
> minOccurs="0" maxOccurs="unbounded"/>
> <xs:element name="Attribute" type="core:RAPType"
> minOccurs="0" maxOccurs="unbounded"/>
> <xs:element name="Proficiency" type="core:RAPType"
> minOccurs="0"
=== message truncated ===>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail:
users-help_at_jaxb.dev.java.net
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com