You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Nathan Beyer (JIRA)" <ji...@apache.org> on 2006/07/31 01:34:14 UTC

[jira] Commented: (HARMONY-997) String.replaceAll method does not work like RI if replacement string contains a backslash

    [ http://issues.apache.org/jira/browse/HARMONY-997?page=comments#action_12424453 ] 
            
Nathan Beyer commented on HARMONY-997:
--------------------------------------

Do you have some documentation or code to assert that this is a bug in Harmony and not a bug in the RI? Based on my quick read of the API, it would seem that doing a replacement with a '\' character, if properly escaped should work. Even if it's not meant to, then a StringIndexOutOfBoundsException seems like a weird error.

In any case, the underlying difference is in the regex module, so any further examples should be expressed with the underlying APIs.

Thanks.

> String.replaceAll method does not work like RI if replacement string contains a backslash
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-997
>                 URL: http://issues.apache.org/jira/browse/HARMONY-997
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mikhail Fursov
>         Assigned To: Nathan Beyer
>            Priority: Minor
>
> This test:
> "replace me".replaceAll("me", "\\");
> produces different  results when runned on Harmony or RI
> RI fails with a message:
> Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
>         at java.lang.String.charAt(String.java:558)
>         at java.util.regex.Matcher.appendReplacement(Matcher.java:696)
>         at java.util.regex.Matcher.replaceAll(Matcher.java:806)
>         at java.lang.String.replaceAll(String.java:2000)
>         at Test.main(Test.java:13)
> while Harmony allows such replacement.
> I think this is Harmony bug.

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