harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1149) [classlib][util] unexpected PatternSyntaxException for String.replaceFirst()/replaceAll()
Date Fri, 11 Aug 2006 05:14:15 GMT
[classlib][util] unexpected PatternSyntaxException for String.replaceFirst()/replaceAll()
-----------------------------------------------------------------------------------------

                 Key: HARMONY-1149
                 URL: http://issues.apache.org/jira/browse/HARMONY-1149
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Vladimir Ivanov


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