From d1a86006ada3468b74f1970e7ec090067165d262 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Tue, 26 Apr 2022 14:49:29 -0500 Subject: [PATCH] Simply code when filterObjecClazz is not null Co-authored-by: BJ Hargrave --- .../internal/serviceregistry/ServiceRegistry.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java index 3bb427f51..bec299978 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java @@ -1077,13 +1077,16 @@ private List> lookupServiceRegistrations(String clazz if (filter instanceof FilterImpl) { // check if we can determine the clazz from the filter String filterObjectClazz = ((FilterImpl) filter).getRequiredObjectClass(); - if (filterObjectClazz != null && ((FilterImpl) filter).getChildren().isEmpty()) { - // this is a simple (objectClass=serviceClass) filter; - // no need to evaluate the filter - filter = null; + if (filterObjectClazz != null) { + result = publishedServicesByClass.get(filterObjectClazz); + if (((FilterImpl) filter).getChildren().isEmpty()) { + // this is a simple (objectClass=serviceClass) filter; + // no need to evaluate the filter + filter = null; + } + } else { + result = allPublishedServices; } - result = filterObjectClazz == null ? allPublishedServices - : publishedServicesByClass.get(filterObjectClazz); } else { // have to check all services result = allPublishedServices;