You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Bob Foster <bo...@objfac.com> on 2004/03/22 19:49:57 UTC

maxOccurs="99999"

Just a comment. Xerces' handling of large maxOccurs values seems pretty 
broken. When I debugged into it, I discovered that the outofmemory 
exceptions were caused by Xerces trying to allocate, IIRC, a table with 
dimensions 199999*199999.

Yes, you can always tell the user to use "unbounded", but Xerces should 
not fail with an utterly predictable OutOfMemoryException (which, by the 
way, can fail silently if it happens in a background thread in some 
environments) for this case.

It would be far better to pick a smaller upper bound by default and 
require an option to be set to go over it. This would allow you to 
produce an error message like "maxOccurs too large; use 'unbounded' 
instead" that the user could understand.

Bob


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: maxOccurs="99999"

Posted by Bob Foster <bo...@objfac.com>.
Thanks. Good to know.

Bob

Michael Glavassevich wrote:
> Hi Bob,
> 
> Applications are already able to set an upper bound on maxOccurs. All you
> have to do is register a SecurityManager [1][2] on an instance of the
> parser and call setMaxOccurNodeLimit(int) on the SecurityManager
> with the desired limit.
> 
> [1] http://xml.apache.org/xerces2-j/properties.html#security-manager
> [2] http://xml.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/util/SecurityManager.html
> 
> On Mon, 22 Mar 2004, Bob Foster wrote:
> 
> 
>>It would be far better to pick a smaller upper bound by default and
>>require an option to be set to go over it. This would allow you to
>>produce an error message like "maxOccurs too large; use 'unbounded'
>>instead" that the user could understand.
>>
>>Bob
> 
> 
> ---------------------------
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: maxOccurs="99999"

Posted by Michael Glavassevich <mr...@apache.org>.
Hi Bob,

Applications are already able to set an upper bound on maxOccurs. All you
have to do is register a SecurityManager [1][2] on an instance of the
parser and call setMaxOccurNodeLimit(int) on the SecurityManager
with the desired limit.

[1] http://xml.apache.org/xerces2-j/properties.html#security-manager
[2] http://xml.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/util/SecurityManager.html

On Mon, 22 Mar 2004, Bob Foster wrote:

> It would be far better to pick a smaller upper bound by default and
> require an option to be set to go over it. This would allow you to
> produce an error message like "maxOccurs too large; use 'unbounded'
> instead" that the user could understand.
>
> Bob

---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org