You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Nick Sydenham (JIRA)" <xe...@xml.apache.org> on 2007/10/05 19:42:52 UTC

[jira] Updated: (XERCESJ-589) Bug with pattern restriction on long strings

     [ https://issues.apache.org/jira/browse/XERCESJ-589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Sydenham updated XERCESJ-589:
----------------------------------

    Attachment: RegularExpression.java

I've altered the "public boolean matches(String target, int start, int end, Match match)" method so that it can handle some instances of large strings that have a pattern match applied to them. The change is not perfect and will likely not match groups of characters for instance that are separated by a comma or space. It will however work quite nicely where the pattern is checking that the string only contains valid characters.

As a previous poster said the code is not well documented and would take serious study to refactor. To make this hack more palatable there could be a feature to turn it on or off (note that it only gets invoked for values over 200 characters already) and/or some separator searching (e.g. break on the nearest non-alphanumeric character). If this is desirable then if a core Xerces coder approves I'll attempt to add the feature(s).

> 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 Structures
>    Affects Versions: 2.3.0
>         Environment: Operating System: All
> Platform: All
>            Reporter: Mark Woon
>         Attachments: RegularExpression.java, RegularExpression.java, 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.
-
You can reply to this email to add a comment to the issue online.


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