[
https://issues.apache.org/jira/browse/XERCESJ-176?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Elliotte Rusty Harold resolved XERCESJ-176.
-------------------------------------------
Resolution: Fixed
Current Xerces-J does not exhibit this issue.
Evidence (tested with the reported schema against current main, version
2.12.3):
- The exact schema loads successfully in ~35 ms, even with -Xmx16m; no
errors or
OOM. The JDK validator also accepts it.
- Recursive type definitions are legal in XML Schema 1.0 here:
contains creditInfo2 of type CreditInfo. The required self-recursive
element
makes the type unsatisfiable for any finite document, but that is not a
schema
error.
- Xerces does detect genuinely illegal circular definitions. I verified it
reports:
- ct-props-correct.3 for a self-extending complex type
- mg-props-correct.2 for a self-referencing model group
- st-props-correct.2 for a self-restricting simple type
- The 2002 OOM is in the reporter's own SchemaUtils.getType(...)
recursion,
which walks the cyclic XSType/XSElementDecl graph without tracking
visited
types. Xerces exposes that graph by reference, so cycle handling is the
application's responsibility.
- The issue has had no activity since 2002 and targets 2.0.0 [beta 2].
Recursive types are valid and consumers traversing XSTypeDefinition need a
visited set.
> java.lang.outOfMemory Exception during parsing and getting global elements.
> ---------------------------------------------------------------------------
>
> Key: XERCESJ-176
> URL: https://issues.apache.org/jira/browse/XERCESJ-176
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.0 Structures
> Affects Versions: 2.0.0 [beta 2]
> Environment: Operating System: Windows NT/2K
> Platform: PC
> Reporter: Rahul Sunder
>
> While parsing through the schema, For a few schemas the parsing keeps going
> on
> and on until java.lang.outOfMemory excepton comes up.
> public List getGlobalElements(){
>
> if(globalElements == null){
> int size = globalElementNames.size();
> globalElements = new ArrayList(size);
>
> for(int i=0; i<globalElementNames.size(); i++){
>
> String name = (String)globalElementNames.get(i);
> //SchemaUtils,XSType,XSElementImpl are selfdefined class here
> XSElementDecl elementDecl =
> grammar.getGlobalElementDecl(name);
>
> XSType type = SchemaUtils.getType(elementDecl.fType);
>
> XSElementImpl element = new XSElementImpl(name, type,
> elementDecl);
> element.setGlobal(true);
> element.setXPath("/"+name);
> globalElements.add(element);
> }
> }
> return globalElements;
> }
> When this method is called it goes for a toss-an infintite loop where it is
> getting the type(XSType type = SchemaUtils.getType(elementDecl.fType)
> infinitely. The same elements are got again and again.
> Could you please tell me all the possible cases of schema that this is
> happens?
> Thanx in advance.
> Rahul
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]