You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Artem Aliev (JIRA)" <ji...@apache.org> on 2006/12/04 13:49:21 UTC

[jira] Created: (HARMONY-2418) [regex] java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of specified IllegalArgumentException

[regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException
-------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2418
                 URL: http://issues.apache.org/jira/browse/HARMONY-2418
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Artem Aliev


Problem: According to specification Matcher.usePattern should throw
IllegalArgumentException when argument is null.

Test to reproduce:
import junit.framework.TestCase;

import java.util.regex.*;

public class Test extends TestCase {

        public void testcase() {
                Matcher m = Pattern.compile("(.)+"). matcher("as");
                try {
                        m.usePattern(null);
                }catch (NullPointerException e) {
                        e.printStackTrace();
                        fail("Got Unexpected NullPointerException");
                } catch (IllegalArgumentException e) {
                        e.printStackTrace();
                        System.out.println("Got Expected
IllegalArgumentException");
                } 
    }
}

Output on Harmony:

C:\WS\tst_my>echo off 
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
Foundation or its licensors, as applicable.
java version "1.5.0" 
pre-alpha : not complete or compatible
svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
release build
http://incubator.apache.org/harmony

.java.lang.NullPointerException
        at java.util.regex.Matcher.usePattern(Matcher.java:511)
        at Test.testcase(Test.java:10)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.textui.TestRunner.doRun(TestRunner.java:115)
        at junit.textui.TestRunner.start(TestRunner.java:172)
        at junit.textui.TestRunner.main(TestRunner.java:138)
F
Time: 0.016
There was 1 failure:
1) testcase(Test)junit.framework.AssertionFailedError: Got Unexpected
NullPointerException
        at Test.testcase(Test.java:13)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)

FAILURES!!!
Tests run: 1,  Failures: 1,  Errors: 0

res = 1


Output on RI:
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
.java.lang.IllegalArgumentException: Pattern cannot be null
        at java.util.regex.Matcher.usePattern(Matcher.java:250)
        at Test.testcase(Test.java:10)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.textui.TestRunner.doRun(TestRunner.java:116)
        at junit.textui.TestRunner.start(TestRunner.java:172)
        at junit.textui.TestRunner.main(TestRunner.java:138)
Got Expected IllegalArgumentException

Time: 0.016

OK (1 test)

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

        

[jira] Updated: (HARMONY-2418) [classlib][regex] java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of specified IllegalArgumentException

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2418?page=all ]

Paulex Yang updated HARMONY-2418:
---------------------------------

    Summary: [classlib][regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException  (was: [regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException)

> [classlib][regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2418
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2418
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>
> Problem: According to specification Matcher.usePattern should throw
> IllegalArgumentException when argument is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.util.regex.*;
> public class Test extends TestCase {
>         public void testcase() {
>                 Matcher m = Pattern.compile("(.)+"). matcher("as");
>                 try {
>                         m.usePattern(null);
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         fail("Got Unexpected NullPointerException");
>                 } catch (IllegalArgumentException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> IllegalArgumentException");
>                 } 
>     }
> }
> Output on Harmony:
> C:\WS\tst_my>echo off 
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.NullPointerException
>         at java.util.regex.Matcher.usePattern(Matcher.java:511)
>         at Test.testcase(Test.java:10)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> F
> Time: 0.016
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: Got Unexpected
> NullPointerException
>         at Test.testcase(Test.java:13)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.IllegalArgumentException: Pattern cannot be null
>         at java.util.regex.Matcher.usePattern(Matcher.java:250)
>         at Test.testcase(Test.java:10)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected IllegalArgumentException
> Time: 0.016
> OK (1 test)

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

        

[jira] Closed: (HARMONY-2418) [classlib][regex] java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of specified IllegalArgumentException

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess closed HARMONY-2418.
---------------------------------


Verified.  Thanks.

> [classlib][regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2418
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2418
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Assigned To: Mark Hindess
>         Attachments: HARMONY-2418-test.patch, HARMONY-2418.patch
>
>
> Problem: According to specification Matcher.usePattern should throw
> IllegalArgumentException when argument is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.util.regex.*;
> public class Test extends TestCase {
>         public void testcase() {
>                 Matcher m = Pattern.compile("(.)+"). matcher("as");
>                 try {
>                         m.usePattern(null);
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         fail("Got Unexpected NullPointerException");
>                 } catch (IllegalArgumentException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> IllegalArgumentException");
>                 } 
>     }
> }
> Output on Harmony:
> C:\WS\tst_my>echo off 
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.NullPointerException
>         at java.util.regex.Matcher.usePattern(Matcher.java:511)
>         at Test.testcase(Test.java:10)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> F
> Time: 0.016
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: Got Unexpected
> NullPointerException
>         at Test.testcase(Test.java:13)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.IllegalArgumentException: Pattern cannot be null
>         at java.util.regex.Matcher.usePattern(Matcher.java:250)
>         at Test.testcase(Test.java:10)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected IllegalArgumentException
> Time: 0.016
> OK (1 test)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2418) [classlib][regex] java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of specified IllegalArgumentException

Posted by "Nellya Udovichenko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nellya Udovichenko updated HARMONY-2418:
----------------------------------------

    Attachment: HARMONY-2418-test.patch
                HARMONY-2418.patch

> [classlib][regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2418
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2418
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Attachments: HARMONY-2418-test.patch, HARMONY-2418.patch
>
>
> Problem: According to specification Matcher.usePattern should throw
> IllegalArgumentException when argument is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.util.regex.*;
> public class Test extends TestCase {
>         public void testcase() {
>                 Matcher m = Pattern.compile("(.)+"). matcher("as");
>                 try {
>                         m.usePattern(null);
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         fail("Got Unexpected NullPointerException");
>                 } catch (IllegalArgumentException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> IllegalArgumentException");
>                 } 
>     }
> }
> Output on Harmony:
> C:\WS\tst_my>echo off 
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.NullPointerException
>         at java.util.regex.Matcher.usePattern(Matcher.java:511)
>         at Test.testcase(Test.java:10)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> F
> Time: 0.016
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: Got Unexpected
> NullPointerException
>         at Test.testcase(Test.java:13)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.IllegalArgumentException: Pattern cannot be null
>         at java.util.regex.Matcher.usePattern(Matcher.java:250)
>         at Test.testcase(Test.java:10)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected IllegalArgumentException
> Time: 0.016
> OK (1 test)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2418) [classlib][regex] java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of specified IllegalArgumentException

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov updated HARMONY-2418:
-------------------------------------

    Patch Info: [Patch Available]

> [classlib][regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2418
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2418
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Attachments: HARMONY-2418-test.patch, HARMONY-2418.patch
>
>
> Problem: According to specification Matcher.usePattern should throw
> IllegalArgumentException when argument is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.util.regex.*;
> public class Test extends TestCase {
>         public void testcase() {
>                 Matcher m = Pattern.compile("(.)+"). matcher("as");
>                 try {
>                         m.usePattern(null);
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         fail("Got Unexpected NullPointerException");
>                 } catch (IllegalArgumentException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> IllegalArgumentException");
>                 } 
>     }
> }
> Output on Harmony:
> C:\WS\tst_my>echo off 
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.NullPointerException
>         at java.util.regex.Matcher.usePattern(Matcher.java:511)
>         at Test.testcase(Test.java:10)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> F
> Time: 0.016
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: Got Unexpected
> NullPointerException
>         at Test.testcase(Test.java:13)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.IllegalArgumentException: Pattern cannot be null
>         at java.util.regex.Matcher.usePattern(Matcher.java:250)
>         at Test.testcase(Test.java:10)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected IllegalArgumentException
> Time: 0.016
> OK (1 test)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2418) [classlib][regex] java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of specified IllegalArgumentException

Posted by "Nellya Udovichenko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464241 ] 

Nellya Udovichenko commented on HARMONY-2418:
---------------------------------------------

Please, try the patch.

> [classlib][regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2418
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2418
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Attachments: HARMONY-2418-test.patch, HARMONY-2418.patch
>
>
> Problem: According to specification Matcher.usePattern should throw
> IllegalArgumentException when argument is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.util.regex.*;
> public class Test extends TestCase {
>         public void testcase() {
>                 Matcher m = Pattern.compile("(.)+"). matcher("as");
>                 try {
>                         m.usePattern(null);
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         fail("Got Unexpected NullPointerException");
>                 } catch (IllegalArgumentException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> IllegalArgumentException");
>                 } 
>     }
> }
> Output on Harmony:
> C:\WS\tst_my>echo off 
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.NullPointerException
>         at java.util.regex.Matcher.usePattern(Matcher.java:511)
>         at Test.testcase(Test.java:10)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> F
> Time: 0.016
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: Got Unexpected
> NullPointerException
>         at Test.testcase(Test.java:13)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.IllegalArgumentException: Pattern cannot be null
>         at java.util.regex.Matcher.usePattern(Matcher.java:250)
>         at Test.testcase(Test.java:10)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected IllegalArgumentException
> Time: 0.016
> OK (1 test)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2418) [classlib][regex] java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of specified IllegalArgumentException

Posted by "Nellya Udovichenko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464760 ] 

Nellya Udovichenko commented on HARMONY-2418:
---------------------------------------------

Thanks Mark! Verified. Works successfully.

> [classlib][regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2418
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2418
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Assigned To: Mark Hindess
>         Attachments: HARMONY-2418-test.patch, HARMONY-2418.patch
>
>
> Problem: According to specification Matcher.usePattern should throw
> IllegalArgumentException when argument is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.util.regex.*;
> public class Test extends TestCase {
>         public void testcase() {
>                 Matcher m = Pattern.compile("(.)+"). matcher("as");
>                 try {
>                         m.usePattern(null);
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         fail("Got Unexpected NullPointerException");
>                 } catch (IllegalArgumentException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> IllegalArgumentException");
>                 } 
>     }
> }
> Output on Harmony:
> C:\WS\tst_my>echo off 
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.NullPointerException
>         at java.util.regex.Matcher.usePattern(Matcher.java:511)
>         at Test.testcase(Test.java:10)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> F
> Time: 0.016
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: Got Unexpected
> NullPointerException
>         at Test.testcase(Test.java:13)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.IllegalArgumentException: Pattern cannot be null
>         at java.util.regex.Matcher.usePattern(Matcher.java:250)
>         at Test.testcase(Test.java:10)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected IllegalArgumentException
> Time: 0.016
> OK (1 test)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (HARMONY-2418) [classlib][regex] java.util.regex.Matcher.usePattern(Pattern) throws NPE instead of specified IllegalArgumentException

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess resolved HARMONY-2418.
-----------------------------------

    Resolution: Fixed
      Assignee: Mark Hindess

Applied patches in r495712.  Please confirm that this resolves the issue.


> [classlib][regex] java.util.regex.Matcher.usePattern(Pattern)  throws NPE instead of specified IllegalArgumentException
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2418
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2418
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Assigned To: Mark Hindess
>         Attachments: HARMONY-2418-test.patch, HARMONY-2418.patch
>
>
> Problem: According to specification Matcher.usePattern should throw
> IllegalArgumentException when argument is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.util.regex.*;
> public class Test extends TestCase {
>         public void testcase() {
>                 Matcher m = Pattern.compile("(.)+"). matcher("as");
>                 try {
>                         m.usePattern(null);
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         fail("Got Unexpected NullPointerException");
>                 } catch (IllegalArgumentException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> IllegalArgumentException");
>                 } 
>     }
> }
> Output on Harmony:
> C:\WS\tst_my>echo off 
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.NullPointerException
>         at java.util.regex.Matcher.usePattern(Matcher.java:511)
>         at Test.testcase(Test.java:10)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> F
> Time: 0.016
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: Got Unexpected
> NullPointerException
>         at Test.testcase(Test.java:13)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.IllegalArgumentException: Pattern cannot be null
>         at java.util.regex.Matcher.usePattern(Matcher.java:250)
>         at Test.testcase(Test.java:10)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected IllegalArgumentException
> Time: 0.016
> OK (1 test)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira