[ 
http://issues.apache.org/jira/browse/XERCESJ-589?page=comments#action_12332025 
] 

Christiaan Janssen commented on XERCESJ-589:
--------------------------------------------

I've run across this problem in every version of xerces (that I've used) to 
date. Looking at the code for the matchString function, the problem appears to 
be the recursive nature of the function. No matter what size the stack is set 
to, you always run into this problem if you supply a large enough string to 
parse. This is due to the function pulling a chunk off of the parse string and 
recursively calling the function on the remainder. Given that a string could be 
any length (ie 10,000 characters or even more) thats a lot of recursive calls. 
The only real solution to this problem is to rewrite the function in an 
iterative form thus alleviating the excessive usage of the stack.

> Bug with pattern restriction on long strings
> --------------------------------------------
>
>          Key: XERCESJ-589
>          URL: http://issues.apache.org/jira/browse/XERCESJ-589
>      Project: Xerces2-J
>         Type: Bug
>   Components: XML Schema Structures
>     Versions: 2.3.0
>  Environment: Operating System: All
> Platform: All
>     Reporter: Mark Woon
>     Assignee: Xerces-J Developers Mailing List
>  Attachments: test.xml, test.xsd, test.zip
>
> There is a bug with applying a pattern restriction on long strings while 
> trying
> to validate an XML file against a schema.  I'm including an xml file and xsd
> file that demonstrates this problem.  One character less in <sequence> and the
> problem does not occur.
> As it is, I'm getting
> java.lang.StackOverflowError
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
>         at
> org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown 
> Source)
> ...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to