harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r482722 - 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 Tue, 05 Dec 2006 17:39:18 GMT
Author: ayza
Date: Tue Dec  5 09:39:17 2006
New Revision: 482722

URL: http://svn.apache.org/viewvc?view=rev&rev=482722
Log:
applying patch for HARMONY-2344 ([classlib] [beans] Method propertyChange() in class BeanContextSupport
throws unspecified NPE)

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=482722&r1=482721&r2=482722
==============================================================================
--- 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
Tue Dec  5 09:39:17 2006
@@ -774,12 +774,14 @@
     }
 
     public void propertyChange(PropertyChangeEvent pce) {
+        Object source;
 
-        if (!pce.getPropertyName().equals(BEAN_CONTEXT)) {
+        if (pce == null || pce.getPropertyName() == null ||
+                !pce.getPropertyName().equals(BEAN_CONTEXT)) {
             return;
         }
 
-        Object source = pce.getSource();
+        source = pce.getSource();
 
         if (source instanceof BCSChild) {
             BCSChild ch = (BCSChild) source;

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=482722&r1=482721&r2=482722
==============================================================================
--- 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
Tue Dec  5 09:39:17 2006
@@ -1932,7 +1932,7 @@
         String in[] = new String[5];
         String out[] = (String[]) support.toArray(in);
         assertSame(in, out);
-        List<String> expected = Arrays.asList(new String[] { "a", "b", "c" });
+        List<String> expected = Arrays.asList(new String[] { "a", "b", "c"});
         for (int i = 0; i < expected.size(); i++) {
             assertTrue(expected.contains(out[i]));
         }
@@ -2152,5 +2152,15 @@
                 "okToUseGui"));
         assertEquals(Utils.getField(orig, "designTime"), Utils.getField(ser,
                 "designTime"));
-    }   
+    }
+
+
+    public void testPropertyChangePropertyChangeEvent() {
+        BeanContextServicesSupport s = new BeanContextServicesSupport();
+        PropertyChangeSupport p= new PropertyChangeSupport(new Object());
+
+        p.addPropertyChangeListener(s);
+        p.firePropertyChange(null, new Object(), new Object());
+    }
+
 }



Mime
View raw message