You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2011/12/14 10:46:30 UTC

svn commit: r1214130 - /felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java

Author: clement
Date: Wed Dec 14 09:46:30 2011
New Revision: 1214130

URL: http://svn.apache.org/viewvc?rev=1214130&view=rev
Log:
Fixed FELIX-3271

The proxy must supports hashCode and equals.

Modified:
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java?rev=1214130&r1=1214129&r2=1214130&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java Wed Dec 14 09:46:30 2011
@@ -863,7 +863,7 @@ public class ProvidedService implements 
         /**
          * A method is invoked on the proxy object.
          * If the method is the {@link IPOJOServiceFactory#getService(ComponentInstance)}
-         * method, this method creates a service object if no already created for the asking
+         * method, this method creates a service object if not already created for the asking
          * component instance.
          * If the method is {@link IPOJOServiceFactory#ungetService(ComponentInstance, Object)}
          * the service object is unget (i.e. removed from the map and deleted).
@@ -887,9 +887,18 @@ public class ProvidedService implements 
                 return null;
             }
 
+            // Regular methods from java.lang.Object : equals and hashCode
+            if (arg1.getName().equals("equals")  && arg2 != null  && arg2.length == 1) {
+                return this.equals(arg2[0]);
+            }
+
+            if (arg1.getName().equals("hashCode")) {
+                return this.hashCode();
+            }
+
             throw new UnsupportedOperationException("This service requires an advanced creation policy. "
                     + "Before calling the service, call the getService(ComponentInstance) method to get "
-                    + "the service object. ");
+                    + "the service object. - Method called: " + arg1.getName());
         }
 
         /**