harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-1149) [classlib][regex] unexpected PatternSyntaxException for String.replaceFirst()/replaceAll()
Date Tue, 20 Mar 2007 14:00:37 GMT

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

Alexei Zakharov updated HARMONY-1149:
-------------------------------------

    Component/s: Non-bug differences from RI

Moving it to Non-bug differences from RI. Discussed at http://mail-archives.apache.org/mod_mbox/harmony-dev/200703.mbox/%3c3D8E84095C6A524A985B787423094E40C7944A@mssmsx411%3e

> [classlib][regex] unexpected PatternSyntaxException for String.replaceFirst()/replaceAll()
> ------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1149
>                 URL: https://issues.apache.org/jira/browse/HARMONY-1149
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib, Non-bug differences from RI
>            Reporter: Vladimir Ivanov
>         Assigned To: Alexei Zakharov
>         Attachments: StringTest.patch
>
>
> The Harmony methods String.replaceFirst(String regex, String replacement) and String.replaceAll(String
regex, String replacement) throws PatternSyntaxException on Harmony and works silently on
RI.
> =================== test.java ======================
> import java.util.regex.*;
> public class test  {    
>     public static void main (String [] args) {
>         String str_re = "\\1";
>         try {
>             System.out.println("replaceFirst = " + "abc".replaceFirst(str_re, "x"));
>         } catch (Exception e) {
>             System.out.println("unexpected exception: " + e);
>         }
>         try {
>             System.out.println("replaceAll = " + "abc".replaceAll(str_re, "x"));
>         } catch (Exception e) {
>             System.out.println("unexpected exception: " + e);
>             e.printStackTrace();
>        }
>     }
> }
> ================================================
> Output:
> C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System
optimized over throughput (initial strategy singleparpar))
> replaceFirst = abc
> replaceAll = abc
> C:\tmp\tmp17>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . -showversion
test
> java version 1.5 (subset)
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> unexpected exception: java.util.regex.PatternSyntaxException: No such group yet exists
at this point in the pattern near index: 0
> \1
> ^
> unexpected exception: java.util.regex.PatternSyntaxException: No such group yet exists
at this point in the pattern near index: 0
> \1
> ^
> java.util.regex.PatternSyntaxException: No such group yet exists at this point in the
pattern near index: 0
> \1
> ^
>         at java.util.regex.Pattern.processTerminal(Pattern.java:950)
>         at java.util.regex.Pattern.processSubExpression(Pattern.java:593)
>         at java.util.regex.Pattern.processExpression(Pattern.java:376)
>         at java.util.regex.Pattern.compileImpl(Pattern.java:279)
>         at java.util.regex.Pattern.compile(Pattern.java:261)
>         at java.util.regex.Pattern.compile(Pattern.java:1155)
>         at java.lang.String.replaceAll(String.java:1782)
>         at test.main(test.java:13)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message