harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r394005 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/BeanDescriptor.java test/java/org/apache/harmony/tests/java/beans/BeanDescriptorTest.java
Date Fri, 14 Apr 2006 03:28:48 GMT
Author: smishura
Date: Thu Apr 13 20:28:46 2006
New Revision: 394005

URL: http://svn.apache.org/viewcvs?rev=394005&view=rev
Log:
Fixing HARMONY-225 (BeanDescriptor constructors should throw NullPointerExceptions)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/BeanDescriptorTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java?rev=394005&r1=394004&r2=394005&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
Thu Apr 13 20:28:46 2006
@@ -27,14 +27,18 @@
 
 public class BeanDescriptor extends FeatureDescriptor {
 	
-    private Class beanClass = null;
-    private Class customizerClass = null;
+    private Class beanClass;
+    private Class customizerClass;
 
     /**
      * @com.intel.drl.spec_ref
      */
     public BeanDescriptor(Class beanClass, Class customizerClass) {
         super();
+
+        if (beanClass == null) {
+            throw new NullPointerException();
+        }
         setName(getShortClassName(beanClass));
         this.beanClass = beanClass;
         this.customizerClass = customizerClass;
@@ -45,6 +49,10 @@
      */
     public BeanDescriptor(Class beanClass) {
         super();
+
+        if (beanClass == null) {
+            throw new NullPointerException();
+        }
         setName(getShortClassName(beanClass));
         this.beanClass = beanClass;
     }
@@ -76,4 +84,4 @@
         return result;
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/BeanDescriptorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/BeanDescriptorTest.java?rev=394005&r1=394004&r2=394005&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/BeanDescriptorTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/BeanDescriptorTest.java
Thu Apr 13 20:28:46 2006
@@ -33,19 +33,32 @@
  */
 
 public class BeanDescriptorTest extends TestCase {
-    
+
     /**
-     * 
+     * @tests java.beans.BeanDescriptor#BeanDescriptor(
+     *        java.lang.Class)
      */
-    public BeanDescriptorTest() {
-        super();
+    public void test_Ctor1_NullPointerExpection() {
+        try {
+            // Regression for HARMONY-225
+            new BeanDescriptor(null);
+            fail("No expected NullPointerException");
+        } catch (NullPointerException e) {
+        }
     }
-    
+
     /**
-     *
+     * @tests java.beans.BeanDescriptor#BeanDescriptor(
+     *        java.lang.Class,
+     *        java.lang.Class)
      */
-    public BeanDescriptorTest(String name) {
-        super(name);
+    public void test_Ctor2_NullPointerExpection() {
+        try {
+            // Regression for HARMONY-225
+            new BeanDescriptor(null, String.class);
+            fail("No expected NullPointerException");
+        } catch (NullPointerException e) {
+        }
     }
     
     /**
@@ -55,7 +68,7 @@
         BeanDescriptor bd= new BeanDescriptor(String.class);
         assertEquals(bd.getName(), "String");
     }
-    
+
     /**
      * 
      */



Mime
View raw message