You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2006/12/18 15:44:22 UTC

[jira] Resolved: (HARMONY-2421) [classlib][logging] java.util.logging.FileHandler(String, int, int) throws NPE instead of IllegalArgumentException

     [ http://issues.apache.org/jira/browse/HARMONY-2421?page=all ]

Tim Ellison resolved HARMONY-2421.
----------------------------------

    Resolution: Fixed

Fixed in LOGGING module at repo revision r488288.

Please check that this fully resolves the problem.


> [classlib][logging] java.util.logging.FileHandler(String, int, int) throws NPE instead of IllegalArgumentException
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2421
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2421
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Assigned To: Tim Ellison
>            Priority: Minor
>         Attachments: Harmony-2421-test.patch, Harmony-2421.patch
>
>
> Specification says that in a case of empty String
> IllegalArgumentException should be thrown.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.logging.*;
> public class Test extends TestCase {
>         public void testcase() {
>                 String str = new String();
>                 FileHandler fh = null;
>                 assertTrue("str != null", str != null);
>                 try {
>                         fh = new FileHandler(str, 1, 1);
>                 } catch (SecurityException e) {
>                         e.printStackTrace();
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (IllegalArgumentException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> IllegalArgumentException");
>                 } catch (NullPointerException e) {
>                         e.printStackTrace();
>                         fail("NullPointerException is thrown!");
>                 }
>     }
> }
> Output on Harmony:
> 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: Pattern cannot be empty
>         at Test.testcase(Test.java:13)
>         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.172
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError: NullPointerException is
> thrown!
>         at Test.testcase(Test.java:23)
>         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
>         at java.util.logging.FileHandler.<init>(FileHandler.java:299)
>         at Test.testcase(Test.java:13)
>         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.078
> OK (1 test)
> res = 0
> The same issue and with FileHandler(String) constructor.

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