You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/04/21 06:36:32 UTC

svn commit: r395775 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans: make/common/ src/main/java/java/beans/ src/test/java/org/apache/harmony/tests/java/beans/ src/test/java/tests/api/java/beans/

Author: smishura
Date: Thu Apr 20 21:36:31 2006
New Revision: 395775

URL: http://svn.apache.org/viewcvs?rev=395775&view=rev
Log:
Fix for HARMONY-228 (VetoableChangeSupport should throw NullPointerException)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/VetoableChangeSupportTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/tests/api/java/beans/VetoableChangeSupportTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml?rev=395775&r1=395774&r2=395775&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml Thu Apr 20 21:36:31 2006
@@ -103,7 +103,6 @@
                     <exclude name="**/BeanContextSupportTest.java" />
                     <exclude name="**/EventHandlerTest.java" />
                     <exclude name="**/SimpleBeanInfoTest.java" />
-                    <exclude name="**/VetoableChangeSupportTest.java" />
 
                     <exclude name="tests/api/java/beans/BeanDescriptorTest.java" />
                     <exclude name="tests/api/java/beans/CustomizedPersistenceDelegateTest.java" />
@@ -126,6 +125,7 @@
                     <exclude name="tests/api/java/beans/PropertyVetoExceptionTest.java" />
                     <exclude name="tests/api/java/beans/StatementTest.java" />
                     <exclude name="tests/api/java/beans/VetoableChangeListenerProxyTest.java" />
+                    <exclude name="tests/api/java/beans/VetoableChangeSupportTest.java" />
                     <exclude name="tests/api/java/beans/XMLDecoderTest.java" />
                     <exclude name="tests/api/java/beans/XMLEncoderTest.java" />
                     <exclude name="tests/api/java/beans/beancontext/BeanContextChildSupportTest.java" />

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java?rev=395775&r1=395774&r2=395775&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java Thu Apr 20 21:36:31 2006
@@ -51,6 +51,9 @@
      * @com.intel.drl.spec_ref
      */
     public VetoableChangeSupport(Object sourceBean) {
+        if (sourceBean == null) {
+            throw new NullPointerException();
+        }
         this.sourceBean = sourceBean;
     }
 
@@ -258,7 +261,7 @@
         oos.writeObject(children);
         
         Object source = null;
-        if((sourceBean != null) && (sourceBean instanceof Serializable)) {
+        if(sourceBean instanceof Serializable) {
             source = sourceBean;
         }
         oos.writeObject(source);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/VetoableChangeSupportTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/VetoableChangeSupportTest.java?rev=395775&r1=395774&r2=395775&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/VetoableChangeSupportTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/VetoableChangeSupportTest.java Thu Apr 20 21:36:31 2006
@@ -51,6 +51,19 @@
     public VetoableChangeSupportTest(String name) {
         super(name);
     }
+
+    /**
+     * @tests java.beans.VetoableChangeSupport#VetoableChangeSupport(
+     *        java.lang.Object)
+     */
+    public void testVetoableChangeSupport_null() {
+        try {
+            // Regression for HARMONY-228
+            new VetoableChangeSupport(null);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {
+        }
+    }
     
     /**
      * The test checks the method add() with no property specified

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/tests/api/java/beans/VetoableChangeSupportTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/tests/api/java/beans/VetoableChangeSupportTest.java?rev=395775&r1=395774&r2=395775&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/tests/api/java/beans/VetoableChangeSupportTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/tests/api/java/beans/VetoableChangeSupportTest.java Thu Apr 20 21:36:31 2006
@@ -46,18 +46,6 @@
 	}
 
 	/*
-	 * Constructor a VetoableChangeSupport instance with null source
-	 */
-	public void testVetoableChangeSupport_null() {
-		MockSource source = null;
-		try {
-			VetoableChangeSupport support = new VetoableChangeSupport(source);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
 	 * Class under test for void addVetoableChangeListener(String,
 	 * VetoableChangeListener)
 	 */