harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r553126 - in /harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/beancontext/BeanContextSupport.java test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java
Date Wed, 04 Jul 2007 08:47:05 GMT
Author: pyang
Date: Wed Jul  4 01:47:04 2007
New Revision: 553126

URL: http://svn.apache.org/viewvc?view=rev&rev=553126
Log:
BeanContextSupport.classEquals() should throw NPE on null parameters

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java?view=diff&rev=553126&r1=553125&r2=553126
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextSupport.java
Wed Jul  4 01:47:04 2007
@@ -425,6 +425,9 @@
      * @return true if two class objects are equal or their class names are equal.
      */
     protected static final boolean classEquals(Class clz1, Class clz2) {
+        if (clz1 == null || clz2 == null) {
+            throw new NullPointerException();
+        }
         return clz1 == clz2 || clz1.getName().equals(clz2.getName());
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java?view=diff&rev=553126&r1=553125&r2=553126
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextSupportTest.java
Wed Jul  4 01:47:04 2007
@@ -823,6 +823,12 @@
                 Integer.class));
         assertFalse(MockBeanContextSupport.publicClassEquals(Integer.class,
                 Double.class));
+        try {
+            MockBeanContextSupport.publicClassEquals(null, null);
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected.
+        }
     }
 
     public void testClear() {



Mime
View raw message