[ 
https://issues.apache.org/jira/browse/XERCESJ-380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Glavassevich resolved XERCESJ-380.
------------------------------------------

    Resolution: Fixed

I've just committed an improvement to code in SVN which covers a number of 
common cases. We now build a representation of large minOccurs/maxOccurs in 
constant time and memory (which uses a counter during validation) for element 
and wildcard particles when each model group particle in the content model:

* has minOccurs/maxOccurs == 1; or
* contains only one element/wildcard particle with minOccurs/maxOccurs == 1

Handling sequences, choices and nested minOccurs/maxOccurs is somewhat tricker. 
 We would need a more general solution than the one implemented for elements 
and wildcards to process those gracefully.  I've opened a new JIRA issue [1] 
for tracking that.

[1] http://issues.apache.org/jira/browse/XERCESJ-1227

> stackOverflow with maxOccurs over 5000 and less than unbounded
> --------------------------------------------------------------
>
>                 Key: XERCESJ-380
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-380
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema Structures
>    Affects Versions: 2.0.2
>         Environment: Operating System: Windows XP
> Platform: PC
>            Reporter: afuqua
>         Assigned To: Michael Glavassevich
>
> On Windows XP and NT and 2000, when validating a document with the schema 
> below, I get a stackOverflow. I've seen the overflow report in 2 different 
> locations for different schemas:
> java.lang.StackOverflowError
>       at org.apache.xerces.impl.xs.models.XSDFACM.postTreeBuildInit
> (XSDFACM.java:899)
>       ....
> java.lang.StackOverflowError
>       at org.apache.xerces.impl.xs.models.XSDFACM.calcFollowList
> (XSDFACM.java:732)
>       ....
> Here's an example schema to reproduce the problem:
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema";
>               targetNamespace="http://www.iss.net/cpe/stackOverflow";
>               xmlns:stackOverflow="http://www.iss.net/cpe/stackOverflow";
>               elementFormDefault="qualified"
>               attributeFormDefault="unqualified">
>       
>       <element name="policy" type="stackOverflow:PolicyType"/>
>       <complexType name="PolicyType">
>               <sequence>
>                       <!-- fails for me as low as 5000 and up -->
>                       <element name='sensitivity' 
> type='stackOverflow:sensitivityType' minOccurs='0' maxOccurs='65535'/>
>               </sequence>
>       </complexType>
>       
>       <complexType name="sensitivityType">
>               <attribute name="sensitivity" type="int" use="required"/>
>       </complexType>
> </schema>
> Here's a code excerpt:
> DOMParser domParser = new DOMParser();
> domParser.setErrorHandler( errorHandler );
> domParser.setFeature( "http://xml.org/sax/features/namespaces";, true );
> domParser.setFeature( "http://apache.org/xml/features/validation/schema";, 
> true );
> domParser.setFeature( "http://xml.org/sax/features/validation";, true );
> domParser.setProperty( "http://apache.org/xml/properties/schema/external-
> schemaLocation", ....);
> domParser.parse( new InputSource( new StringReader( .... )) );

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to