Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2016-08-11 16:10:42 +0000
committerThomas Watson2016-08-11 16:15:32 +0000
commit4d483b30c4fd75279878065b2bf72d0b1256a2b1 (patch)
tree4f95bbd64d006eccd8f7584c83b67affc703497a /bundles/org.eclipse.equinox.region.tests
parent79ffdde918f9fd9527bb4fa465fa7991f4736dea (diff)
downloadrt.equinox.bundles-4d483b30c4fd75279878065b2bf72d0b1256a2b1.tar.gz
rt.equinox.bundles-4d483b30c4fd75279878065b2bf72d0b1256a2b1.tar.xz
rt.equinox.bundles-4d483b30c4fd75279878065b2bf72d0b1256a2b1.zip
Bug 499552 - [region] NPE can happen in RegionServiceFindHook when
ServiceEvent points to a SerivceReference that has been unregistered Change-Id: Ia73d822f1d082868dda72f2c4c116c7c343ae93b Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.region.tests')
-rw-r--r--bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/internal/tests/hook/RegionServiceFindHookTests.java45
1 files changed, 44 insertions, 1 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);

Back to the top