commit | 6cdf87759dcd2076ac7df216eef04adf3769391c | [log] [tgz] |
---|---|---|
author | Marcel Offermans <marrs@apache.org> | Tue Jan 27 14:55:29 2009 +0000 |
committer | Marcel Offermans <marrs@apache.org> | Tue Jan 27 14:55:29 2009 +0000 |
tree | 1a033a927b907477f6807f586a9ad54973405aff | |
parent | 3f45e9b5f408b5043c63d547ae389306f19a05c9 [diff] |
Added two patches suggested by Pierre and Arjun to fix an issue with service dependencies that use a filter, where the filter can return services that are of a different type than the specified type. Also added some logging. git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@738105 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java b/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java index 9a53bdf..2da0a23 100644 --- a/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java +++ b/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceDependency.java
@@ -173,6 +173,11 @@ public Object addingService(ServiceReference ref) { Object service = m_context.getService(ref); + // first check to make sure the service is actually an instance of our service + if (!m_trackedServiceName.isInstance(service)) { + return null; + } + // we remember these for future reference, needed for required service callbacks m_reference = ref; m_serviceInstance = service;
diff --git a/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceImpl.java b/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceImpl.java index b2848d1..5fbcd35 100644 --- a/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceImpl.java +++ b/dependencymanager/src/main/java/org/apache/felix/dependencymanager/ServiceImpl.java
@@ -630,6 +630,7 @@ wrapper.setServiceRegistration(registration); } catch (IllegalArgumentException iae) { + m_logger.log(Logger.LOG_ERROR, "Could not register service " + m_serviceInstance, iae); // set the registration to an illegal state object, which will make all invocations on this // wrapper fail with an ISE (which also occurs when the SR becomes invalid) wrapper.setIllegalState();