diff options
5 files changed, 53 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/hook/RegionServiceFindHookTests.java b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/hook/RegionServiceFindHookTests.java index dfe0fce54..91f87964a 100644 --- a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/hook/RegionServiceFindHookTests.java +++ b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/hook/RegionServiceFindHookTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 VMware Inc. + * Copyright (c) 2011, 2015 VMware Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -105,6 +105,49 @@ public class RegionServiceFindHookTests { } @Test + public void testFindUnregisteredService() throws InvalidSyntaxException, BundleException { + ServiceReference<Object> ref = new ServiceReference<Object>() { + + @Override + public Object getProperty(String key) { + return null; + } + + @Override + public String[] getPropertyKeys() { + return new String[0]; + } + + @Override + public Bundle getBundle() { + return null; + } + + @Override + public Bundle[] getUsingBundles() { + return null; + } + + @Override + public boolean isAssignableTo(Bundle bundle, String className) { + return false; + } + + @Override + public int compareTo(Object reference) { + return 1; + } + }; + this.candidates.add(ref); + + RegionFilter filter = createFilter(BUNDLE_B); + region(REGION_A).connectRegion(region(REGION_B), filter); + + this.bundleFindHook.find(bundleContext(BUNDLE_A), "", "", false, this.candidates); + assertFalse(this.candidates.contains(ref)); + } + + @Test public void testFindInDisconnectedRegion() { this.candidates.add(serviceReference(BUNDLE_B)); this.bundleFindHook.find(bundleContext(BUNDLE_A), "", "", false, this.candidates); diff --git a/bundles/org.eclipse.equinox.region/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.region/META-INF/MANIFEST.MF index 2166381e3..222964e67 100644 --- a/bundles/org.eclipse.equinox.region/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.region/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.equinox.region -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 1.3.100.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Fragment-Host: system.bundle ExtensionBundle-Activator: org.eclipse.equinox.internal.region.RegionManager diff --git a/bundles/org.eclipse.equinox.region/pom.xml b/bundles/org.eclipse.equinox.region/pom.xml index e2009a77d..6a9a84def 100644 --- a/bundles/org.eclipse.equinox.region/pom.xml +++ b/bundles/org.eclipse.equinox.region/pom.xml @@ -19,6 +19,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.region</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilter.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilter.java index 9b99faf6f..ab8a61866 100644 --- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilter.java +++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2013 VMware Inc and others. + * Copyright (c) 2011, 2016 VMware Inc and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,6 +35,9 @@ public final class StandardRegionFilter implements RegionFilter { } public boolean isAllowed(Bundle bundle) { + if (bundle == null) { + return false; + } HashMap<String, Object> attrs = new HashMap<String, Object>(4); String bsn = bundle.getSymbolicName(); if (bsn != null) { diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionServiceFindHook.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionServiceFindHook.java index c8fb1c4a4..e12175a5b 100644 --- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionServiceFindHook.java +++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionServiceFindHook.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 VMware Inc. + * Copyright (c) 2015, 2016 VMware Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -74,7 +74,8 @@ public final class RegionServiceFindHook implements FindHook { */ @Override protected boolean contains(Region region, ServiceReference<?> candidate) { - return region.contains(candidate.getBundle()); + Bundle b = candidate.getBundle(); + return b == null ? false : region.contains(b); } /** |