harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hindess (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-101) NPE in java.util.regex.Pattern.compile()
Date Thu, 18 Jun 2009 09:31:10 GMT

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

Mark Hindess closed HARMONY-101.
--------------------------------

    Assignee: Mark Hindess

This issue was invalid so I'm closing it.



> NPE in java.util.regex.Pattern.compile()
> ----------------------------------------
>
>                 Key: HARMONY-101
>                 URL: https://issues.apache.org/jira/browse/HARMONY-101
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Svetlana Samoilenko
>            Assignee: Mark Hindess
>
> According to 1.4.2 and 1.5 specifications for java.util.regex.Pattern.matches(String
regex,CharSequence input)                              
> An invocation of this convenience method of the form 
>         Pattern.matches(regex, input);
> behaves in exactly the same way as the expression 
>         Pattern.compile(regex).matcher(input).matches()
> Harmony throws unspecified NPE for Pattern.compile and returns false instead of true
for Pattern.matches().
> Code to reproduce: 
> import java.util.regex.Pattern;
> public class test2 {
>     public static void main(String[] args) {             
>         System.out.println("boolean is true="+Pattern.matches("[,&&\\p{Punct}]",
","));
>         System.out.println("boolean is true="+Pattern.compile("[,&&\\p{Punct}]").matcher(",").matches());
         
>     }
> }
>  Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
> 2. Compile test2.java using BEA 1.4 javac 
> > javac -d . test2.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test2
> Output: 
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
> java version "1.4.2_04" 
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native
Threads, GC strategy: parallel) 
> boolean is true=true
> boolean is true=true
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.

> boolean is true=false
> java.lang.NullPointerException
>         at test2.main(test2.java:5)
> Suggested junit test case:
> ------------------------ PatternTest.java -------------------------------------------------

> import junit.framework.*; 
> import java.util.regex.Pattern;
> public class PatternTest extends TestCase { 
>     public static void main(String[] args) { 
>         junit.textui.TestRunner.run(PatternTest.class); 
>     } 
>     public void test_compile () { 
>         assertTrue(Pattern.matches("[,&&\\p{Punct}]", ","));
>         assertTrue(Pattern.compile("[,&&\\p{Punct}]").matcher(",").matches());
                    
>      } 
> }

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