Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2011-05-04 13:52:10 -0400
committerslewis2011-05-04 13:52:10 -0400
commit51c96baa11f872a2dddc7b35755483006cbbfe11 (patch)
tree9a005e13d4ae9dd093887f0108d86c6c79e4bb83
parent3d37515bad1736663e73652c89b6fc8c68feab75 (diff)
downloadorg.eclipse.ecf-51c96baa11f872a2dddc7b35755483006cbbfe11.tar.gz
org.eclipse.ecf-51c96baa11f872a2dddc7b35755483006cbbfe11.tar.xz
org.eclipse.ecf-51c96baa11f872a2dddc7b35755483006cbbfe11.zip
Revised fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=344716
-rw-r--r--osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
index cce1a9351..980d6706c 100644
--- a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
+++ b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java
@@ -357,10 +357,12 @@ public class RemoteServiceAdmin implements
return clientBundle.getBundleContext();
}
- private Bundle getClientBundle() {
- return clientBundle;
+ private Bundle getRSABundle() {
+ BundleContext bundleContext = Activator.getContext();
+ if (bundleContext == null) return null;
+ return bundleContext.getBundle();
}
-
+
private void addImportRegistration(ImportRegistration importRegistration) {
synchronized (importedRegistrations) {
importedRegistrations.add(importRegistration);
@@ -592,14 +594,14 @@ public class RemoteServiceAdmin implements
}
exportReference.close();
removeExportRegistration(this);
- Bundle clientBundle = getClientBundle();
+ Bundle rsaBundle = getRSABundle();
// Only publish events
- if (publish && clientBundle != null)
+ if (publish && rsaBundle != null)
publishEvent(
new RemoteServiceAdminEvent(
endpointDescription.getContainerID(),
RemoteServiceAdminEvent.EXPORT_UNREGISTRATION,
- clientBundle, exportReference, t),
+ rsaBundle, exportReference, t),
endpointDescription);
}
@@ -812,13 +814,13 @@ public class RemoteServiceAdmin implements
}
importReference.close();
removeImportRegistration(this);
- Bundle clientBundle = getClientBundle();
- if (publish && clientBundle != null)
+ Bundle rsaBundle = getRSABundle();
+ if (publish && rsaBundle != null)
publishEvent(
new RemoteServiceAdminEvent(
endpointDescription.getContainerID(),
RemoteServiceAdminEvent.IMPORT_UNREGISTRATION,
- clientBundle, importReference, t),
+ rsaBundle, importReference, t),
endpointDescription);
}
@@ -920,11 +922,17 @@ public class RemoteServiceAdmin implements
eventTypeName = "IMPORT_WARNING"; //$NON-NLS-1$
break;
}
- if (eventTypeName == null)
+ if (eventTypeName == null) {
logError("postEvent", "Event type=" + eventType //$NON-NLS-1$ //$NON-NLS-2$
+ " not understood for event=" + event + ". Not posting"); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
String topic = "org/osgi/service/remoteserviceadmin/" + eventTypeName; //$NON-NLS-1$
- Bundle rsaBundle = getClientBundle();
+ Bundle rsaBundle = getRSABundle();
+ if (rsaBundle == null) {
+ logError("postEvent", "RSA Bundle is null. Not posting remote service admin event="+event); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
Dictionary eventProperties = new Properties();
eventProperties.put("bundle", rsaBundle); //$NON-NLS-1$
eventProperties.put("bundle.id", //$NON-NLS-1$
@@ -987,7 +995,7 @@ public class RemoteServiceAdmin implements
exportRegistration.getContainerID(),
(exception == null) ? RemoteServiceAdminEvent.EXPORT_REGISTRATION
: RemoteServiceAdminEvent.EXPORT_ERROR,
- getClientBundle(), exportReference, exception);
+ getRSABundle(), exportReference, exception);
publishEvent(rsaEvent, exportRegistration.getEndpointDescription());
}
@@ -999,7 +1007,7 @@ public class RemoteServiceAdmin implements
importRegistration.getContainerID(),
(exception == null) ? RemoteServiceAdminEvent.IMPORT_REGISTRATION
: RemoteServiceAdminEvent.IMPORT_ERROR,
- getClientBundle(), importReference, exception);
+ getRSABundle(), importReference, exception);
publishEvent(rsaEvent, importRegistration.getEndpointDescription());
}

Back to the top