harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolay Kuznetsov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-773) regex Patter2Test.testCompile4 is incorrect
Date Wed, 05 Jul 2006 16:21:29 GMT
regex Patter2Test.testCompile4 is incorrect
-------------------------------------------

         Key: HARMONY-773
         URL: http://issues.apache.org/jira/browse/HARMONY-773
     Project: Harmony
        Type: Bug

  Components: Non-bug differences from RI  
 Environment: All
    Reporter: Nikolay Kuznetsov


The test Patter2Test.testCompile4 for regex package works incorrectly.
Input sequence modification after creation of the matcher is invalid action, subsequent matcher.reset(test)
call should be used to update matcher with new string:
...
Matcher matcher = pattern.matcher(text);
...
if (found) {
VVVVVVVVVVVVVVVVVVVVVVVV
    // modify text
    text.delete(0, text.length());
    text.append("Text have been changed.");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}

found = matcher.find();

The spec does not specifies this case directly, but there are some considerations:
1) RI does not support this:
I can easily modify this testcase to make RI fail with IndexOutOfBounsException(change "Text
have been changed"  to "AA");
2) Correct behaviour is not specified:
What about concurrent modification, what should happen with ranges, should input sequense
be copied of length checks should be performed prior to every input string access operation
and so on. 


-- 
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


Mime
View raw message