harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry M. Kononov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-362) java.beans.beancontext.BeanContextServicesSupport.hasService(Class c) does not throw NullPointerException
Date Tue, 18 Apr 2006 06:43:22 GMT
java.beans.beancontext.BeanContextServicesSupport.hasService(Class c) does not throw NullPointerException
---------------------------------------------------------------------------------------------------------

         Key: HARMONY-362
         URL: http://issues.apache.org/jira/browse/HARMONY-362
     Project: Harmony
        Type: Bug

  Components: Classlib  
    Reporter: Dmitry M. Kononov
    Priority: Minor


java.beans.beancontext.BeanContextServicesSupport.hasService(Class c):
Harmony does not throw NullPointerException when parameter c=null, while RI throws it.
Specification doesn't say anything about NullPointerException throwing.

Junit test to reproduce the problem:
import junit.framework.TestCase;
import java.beans.beancontext.BeanContextServicesSupport;

public class BeanContextServicesSupportTest extends TestCase {
    public void test_hasServiceLjava_lang_Class() {
        BeanContextServicesSupport obj = new BeanContextServicesSupport();
        boolean b = true;
        try {
            obj.hasService(null);
            b = false;
        } catch (NullPointerException t) {
            t.printStackTrace();
        }
        assertTrue(b);
    }
}

RI output:
.java.lang.NullPointerException: serviceClass
        at java.beans.beancontext.BeanContextServicesSupport.hasService(BeanCont
extServicesSupport.java:727)
        at BeanContextServicesSupportTest.test_hasServiceLjava_lang_Class(BeanCo
ntextServicesSupportTest.java:15)
        at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[
Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
        at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;
I)Ljava.lang.Object;(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:116)
        at junit.textui.TestRunner.start(TestRunner.java:172)
        at junit.textui.TestRunner.main(TestRunner.java:138)

Time: 0.031

OK (1 test)
HARMONY output:
java version 1.4.2 (subset)
(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as app
licable.
..
Time: 0.016
There was 1 failure:
1) test_hasServiceLjava_lang_Class(BeanContextServicesSupportTest)junit.framewor
k.AssertionFailedError
        at BeanContextServicesSupportTest.test_hasServiceLjava_lang_Class(BeanCo
ntextServicesSupportTest.java:20)
        at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:211)


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


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