xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Siddle (JIRA)" <xerces-j-...@xml.apache.org>
Subject [jira] [Commented] (XERCESJ-639) Regex of ")" not rejected
Date Mon, 20 Jun 2011 13:41:47 GMT

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

Jon Siddle commented on XERCESJ-639:
------------------------------------

The problem seems to occur with any pattern ending with an unescaped ")". The following code
demonstrates the problem:


import org.apache.xerces.impl.xpath.regex.RegularExpression;

public class TestXercesRegex {

  public static void main(String[] args) {
    testRegex("abc", "abc");       // Matches - OK
    testRegex("(abc)", "abc");     // Matches - OK
    testRegex("abc)", "abc");      // Matches - Should throw exception
    testRegex("abc)x", "abcx");  // Throws exception - OK
    testRegex("(abc", "abc");     // Throws exception - OK
  }

  private static void testRegex(String pattern, String text) {
    RegularExpression re = new RegularExpression(patter);
    System.out.printf("%s ~ %s => %s\n", regex, text, re.matches(text));
  }

}


> Regex of ")" not rejected
> -------------------------
>
>                 Key: XERCESJ-639
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-639
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Datatypes
>    Affects Versions: 2.3.0
>         Environment: Operating System: Other
> Platform: Other
>            Reporter: James Clark
>
> Xerces fails to reject the following schema:
> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
>  <xs:element name="test">
>   <xs:simpleType>
>    <xs:restriction base="xs:string">
>      <xs:pattern value=")"/>
>    </xs:restriction>
>   </xs:simpleType>
>  </xs:element>
> </xs:schema>
> (It treats it as equivalent to value="".)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message