harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2490) java.beans.DefaultPersistenceDelegate.initialize() does not throw NullPointerException (RI compatibility issue)
Date Wed, 06 Dec 2006 11:39:21 GMT
java.beans.DefaultPersistenceDelegate.initialize() does not throw NullPointerException (RI
compatibility issue)
---------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2490
                 URL: http://issues.apache.org/jira/browse/HARMONY-2490
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Anton Ivanov
            Priority: Trivial


NullPointerException is not thrown for initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder out) if oldInstance == null while RI throws NullPointerException.
It is not explicitly specified that NullPointerException should be thrown in such a case,
however it is written in specification for java.beans package:
"Unless explicitly stated, null values or empty Strings are not valid parameters for the methods
in this package. You may expect to see exceptions if these parameters are used"
This is a compatibility issue.

The test to reproduce the problem:

import junit.framework.TestCase;
import java.beans.*;

public class InitializeTest extends TestCase {     

   public void test1 () {  

       try {  
           testDefaultPersistenceDelegate obj 
                   = new testDefaultPersistenceDelegate();

           obj.initialize(Object.class, null, new Object(), new Encoder());  
           fail("NullPointerException should be thrown");               
       } catch (NullPointerException e) {
           //expected
       } 
    }  
}

class testDefaultPersistenceDelegate extends DefaultPersistenceDelegate  {
    testDefaultPersistenceDelegate() {
      super();
   }

   public void initialize(Class type, Object oldInstance, Object newInstance, Encoder out)
   {
       super.initialize(type,oldInstance, newInstance,out);
   }
}

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