You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ml...@apache.org on 2006/04/28 14:43:37 UTC

svn commit: r397883 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/beancontext/BeanContextChildSupport.java test/java/org/apache/harmony/tests/java/beans/beancontext/BeanContextChildSupportTest.java

Author: mloenko
Date: Fri Apr 28 05:43:35 2006
New Revision: 397883

URL: http://svn.apache.org/viewcvs?rev=397883&view=rev
Log:
fix and regression test for HARMONY-372
BeanContextChildSupport.{serviceAvailable,serviceRevoked} cause StackOverflowError

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextChildSupport.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/beancontext/BeanContextChildSupportTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextChildSupport.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextChildSupport.java?rev=397883&r1=397882&r2=397883&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextChildSupport.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextChildSupport.java Fri Apr 28 05:43:35 2006
@@ -200,20 +200,20 @@
      * @com.intel.drl.spec_ref
      */
     public void serviceAvailable(BeanContextServiceAvailableEvent bcsae) {
-        
-        BeanContextServicesListener l = 
-            (BeanContextServicesListener) beanContextChildPeer;
-        l.serviceAvailable(bcsae);
+        if (isDelegated()) {
+            ((BeanContextServicesListener) beanContextChildPeer)
+                    .serviceAvailable(bcsae);
+        }
     }
 
     /**
      * @com.intel.drl.spec_ref
      */
     public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) {
-        
-        BeanContextServicesListener l = 
-            (BeanContextServicesListener) beanContextChildPeer;
-        l.serviceRevoked(bcsre);
+        if (isDelegated()) {
+            ((BeanContextServicesListener) beanContextChildPeer)
+                    .serviceRevoked(bcsre);
+        }
     }
     
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/beancontext/BeanContextChildSupportTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/beancontext/BeanContextChildSupportTest.java?rev=397883&r1=397882&r2=397883&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/beancontext/BeanContextChildSupportTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/beancontext/BeanContextChildSupportTest.java Fri Apr 28 05:43:35 2006
@@ -21,6 +21,8 @@
 package org.apache.harmony.tests.java.beans.beancontext;
 
 import java.beans.beancontext.BeanContextChildSupport;
+import java.beans.beancontext.BeanContextServiceAvailableEvent;
+import java.beans.beancontext.BeanContextServiceRevokedEvent;
 import java.beans.beancontext.BeanContextSupport;
 
 import junit.framework.Test;
@@ -131,6 +133,16 @@
         catch(Exception e) {
             fail("Unexpected exception: " + e + " caused by: " + e.getCause());
         }
+    }
+
+    /**
+     * @test java.beans.beancontext.BeanContextChildSupport#serviceAvailable(java.beans.beancontext.BeanContextServiceAvailableEvent)
+     * @test java.beans.beancontext.BeanContextChildSupport#serviceRevoked(java.beans.beancontext.BeanContextServiceRevokedEvent)
+     */
+    public void testServiceAvailable() {
+        //Regression for HARMONY-372
+        (new java.beans.beancontext.BeanContextChildSupport()).serviceAvailable(null);
+        (new java.beans.beancontext.BeanContextChildSupport()).serviceRevoked(null); 
     }
 
     /** UTILITY METHODS **/