XMLBeans
  1. XMLBeans
  2. XMLBEANS-495

StackOverflowError when parsing a large number of characters in an XML element

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Version 2.6
    • Fix Version/s: None
    • Component/s: Validator
    • Labels:
      None
    • Environment:
      All

      Description

      When XMLBeans validates a very long XML String (4000 or so chars), it generates a StackOverFlowError as shown below. In the schema for this element I have defined a pattern and a min/max length but XMLBeans is applying the pattern first before checking the length. The solution is the fix applied to the class RegularExpression in xerces - see https://issues.apache.org/jira/browse/XERCESJ-589 which went into version 2.11.

      <xs:simpleType name="info">
      <xs:restriction base="xs:string">
      <xs:maxLength value="3"/>
      <xs:minLength value="2"/>
      <xs:pattern value="[A-Z0-9]+"/>
      </xs:restriction>
      </xs:simpleType>

      Exception in thread "main" java.lang.StackOverflowError
      at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1662)
      at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
      at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
      at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
      at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
      at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)

        Activity

        Mandy Warren created issue -
        Mandy Warren made changes -
        Field Original Value New Value
        Description When XMLBeans validates a very long XML String (1000 or more chars), it generates a StackOverFlowException as shown below. In the schema for this element I have defined a pattern and a min/max length but XMLBeans is applying the pattern first before checking the length. The solution is the fix applied to the class RegularExpression in xerces - see https://issues.apache.org/jira/browse/XERCESJ-589 which went into version 2.11.

        <xs:simpleType name="info">
        <xs:restriction base="xs:string">
        <xs:maxLength value="3"/>
        <xs:minLength value="2"/>
        <xs:pattern value="[A-Z0-9]+"/>
        </xs:restriction>
        </xs:simpleType>


        Exception in thread "main" java.lang.StackOverflowError
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1662)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        When XMLBeans validates a very long XML String (4000 or so chars), it generates a StackOverFlowError as shown below. In the schema for this element I have defined a pattern and a min/max length but XMLBeans is applying the pattern first before checking the length. The solution is the fix applied to the class RegularExpression in xerces - see https://issues.apache.org/jira/browse/XERCESJ-589 which went into version 2.11.

        <xs:simpleType name="info">
        <xs:restriction base="xs:string">
        <xs:maxLength value="3"/>
        <xs:minLength value="2"/>
        <xs:pattern value="[A-Z0-9]+"/>
        </xs:restriction>
        </xs:simpleType>


        Exception in thread "main" java.lang.StackOverflowError
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1662)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)
        at org.apache.xmlbeans.impl.regex.RegularExpression.matchString(RegularExpression.java:1872)

          People

          • Assignee:
            Unassigned
            Reporter:
            Mandy Warren
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development