harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r447839 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/beancontext/BeanContextServicesSupport.java test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java
Date Tue, 19 Sep 2006 13:17:18 GMT
Author: tellison
Date: Tue Sep 19 06:17:17 2006
New Revision: 447839

URL: http://svn.apache.org/viewvc?view=rev&rev=447839
Log:
Apply patch HARMONY-1397 ([classlib][beans] compatibility: BeanContextServicesSupport().getCurrentServiceSelectors(..)
returns 'null' on Harmony and object on RI)

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java?view=diff&rev=447839&r1=447838&r2=447839
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java
Tue Sep 19 06:17:17 2006
@@ -422,6 +422,24 @@
         }
     }
 
+    private class BCSIterator implements Iterator {
+    	private Iterator it;
+    	public BCSIterator(Iterator it) {
+    		this.it = it;
+    	}
+    	
+    	public boolean hasNext() {
+    		return it.hasNext();
+    	}
+
+    	public Object next() {
+    		return it.next();
+    	}
+
+    	public void remove() {
+    		//do nothing
+    	}
+    }
     /**
      * @com.intel.drl.spec_ref
      */
@@ -434,9 +452,12 @@
         synchronized (BeanContext.globalHierarchyLock) {
             synchronized (this.services) {
                 BCSSServiceProvider bcsp = this.services.get(serviceClass);
+                if (bcsp == null) {
+                    return null;
+                }
 
-                return bcsp.getServiceProvider().getCurrentServiceSelectors(
-                        getBeanContextServicesPeer(), serviceClass);
+                return new BCSIterator(bcsp.getServiceProvider().getCurrentServiceSelectors(
+                        getBeanContextServicesPeer(), serviceClass));
             }
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java?view=diff&rev=447839&r1=447838&r2=447839
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServicesSupportTest.java
Tue Sep 19 06:17:17 2006
@@ -670,6 +670,14 @@
         MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
         Iterator iter = support.getCurrentServiceSelectors(Collection.class);
         assertNull(iter);
+        //Regression for HARMONY-1397
+        class TestServiceProvider implements BeanContextServiceProvider {
+            public Object getService(BeanContextServices p0, Object p1, Class p2, Object
p3) {return null;}
+            public void releaseService(BeanContextServices p0, Object p1, Object p2) {}
+            public Iterator getCurrentServiceSelectors(BeanContextServices p0, Class p1)
{return null;}
+        }
+        support.addService(BeanContextServicesSupportTest.class, new TestServiceProvider());
+        assertNotNull(support.getCurrentServiceSelectors(BeanContextServicesSupportTest.class));
     }
 
     public void testGetCurrentServiceSelectors() {



Mime
View raw message