[ 
https://issues.apache.org/jira/browse/XERCESJ-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15304132#comment-15304132
 ] 

Ryan Cartmill edited comment on XERCESJ-589 at 5/27/16 2:39 PM:
----------------------------------------------------------------

Sorry to revive this thread again, but...

About 5.5 years ago, I updated my XercesJ version to 2.11.0 to fix this 
problem.  It appeared to fix the problem until yesterday, when I ran across 
this same problem yet again.

I'm using:

Java SE RE 1.6.0_29
XercesJ 2.11.0
SUSE Linux Enterprise Server 10.3, 64 bit


My XSD contains a pattern restriction that hasn't changed in almost 10 years:

{quote}<xs:simpleType name="non-empty-type">
        <xs:restriction base="xs:normalizedString">
                <xs:pattern value="\s*\S[\s\S]*"/>
        </xs:restriction>
</xs:simpleType>{quote}


Later, I have a element named <meta:title-sort> that enforces this simpleType:

{quote}<xs:element name="title-sort" type="meta:non-empty-type">
                <xs:annotation>
                        <xs:documentation>Title of document formatted for 
sorting purposes.</xs:documentation>
                </xs:annotation>
        </xs:element>
{quote}

The problem is, when I have a sorted title longer than 5,880 characters I get a 
stack trace very much like what was listed above:

{quote}Exception in thread "main" java.lang.StackOverflowError
        at 
com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(RegularExpression.java:1586)
        at 
com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(RegularExpression.java:1878)
        at 
com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(RegularExpression.java:1878)
        at 
com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(RegularExpression.java:1878)
...{quote}


Although we've determined that this record's title contains bad data (a title 
shouldn't be longer than 200 characters), I still wanted to report this, in 
case anyone else is still struggling with this problem.





was (Author: cartwheel):
Sorry to revive this thread again, but...

About 5.5 years ago, I updated my XercesJ version to 2.11.0 to fix this 
problem.  It appeared to fix the problem until yesterday, when I ran across 
this same problem yet again.

I'm using:

Java SE RE 1.6.0_29
XercesJ 2.11.0
SUSE Linux Enterprise Server 10.3, 64 bit


My XSD contains a pattern restriction that hasn't changed in almost 10 years:

{quote}<xs:simpleType name="non-empty-type">
        <xs:restriction base="xs:normalizedString">
                <xs:pattern value="\s*\S[\s\S]*"/>
        </xs:restriction>
</xs:simpleType>{quote}


Later, I have a element named <meta:title-sort> that enforces this simpleType:

{quote}<xs:element name="title-sort" type="meta:non-empty-type">
                <xs:annotation>
                        <xs:documentation>Title of document formatted for 
sorting purposes.</xs:documentation>
                </xs:annotation>
        </xs:element>
{quote}

The problem is, when I have a sorted title longer than 5,880 characters I get a 
stack trace exactly like what was listed above:

{quote}Exception in thread "main" java.lang.StackOverflowError
        at 
com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(RegularExpression.java:1586)
        at 
com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(RegularExpression.java:1878)
        at 
com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(RegularExpression.java:1878)
        at 
com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(RegularExpression.java:1878)
...{quote}


Although we've determined that this record's title contains bad data (a title 
shouldn't be longer than 200 characters), I still wanted to report this, in 
case anyone else is still struggling with this problem.




> Bug with pattern restriction on long strings
> --------------------------------------------
>
>                 Key: XERCESJ-589
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-589
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.3.0
>         Environment: Operating System: All
> Platform: All
>            Reporter: Mark Woon
>            Assignee: Khaled Noaman
>             Fix For: 2.10.0
>
>         Attachments: ASF.LICENSE.NOT.GRANTED--test.xml, 
> ASF.LICENSE.NOT.GRANTED--test.xsd, RegularExpression.java, 
> RegularExpression.java, RegularExpression.java, 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 was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-dev-h...@xerces.apache.org

Reply via email to