felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r576140 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
Date Sun, 16 Sep 2007 18:15:39 GMT
Author: pauls
Date: Sun Sep 16 11:15:39 2007
New Revision: 576140

URL: http://svn.apache.org/viewvc?rev=576140&view=rev
Log:
In case that a module imports a package from a service provider and the provider doesn't import
the package we allow the requester to get the service in case he is bound to any older revision
of the module. This is wrong, we need to make sure the requester is wired to the current module
of the provider else the requester might get ClassCastExceptions. Thanks to Peter Doornbusch
for pointing out this bug.

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java?rev=576140&r1=576139&r2=576140&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
Sun Sep 16 11:15:39 2007
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -33,7 +33,7 @@
         m_registration = reg;
         m_bundle = bundle;
     }
-    
+
     protected ServiceRegistrationImpl getServiceRegistration()
     {
         return m_registration;
@@ -140,7 +140,7 @@
         // refernce. In case 3, we simply compare the exporting
         // modules from the package wiring to determine if we need
         // to filter the service reference.
-        
+
         // Case 1: Always include service reference.
         if (requesterWire == null)
         {
@@ -170,6 +170,13 @@
                     // This should not happen, filter to be safe.
                     allow = false;
                 }
+            }
+            else
+            {
+                // O.k. the provider is the exporter of the requester's package, now check
+                // if the requester is wired to the latest version of the provider, if so
+                // then allow else don't (the provider has been updated but not refreshed).
+                allow = ((FelixBundle) m_bundle).getInfo().getCurrentModule() == requesterWire.getExporter();
             }
         }
         // Case 3: Include service reference if the wires have the



Mime
View raw message