Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2016-01-09 17:08:47 +0000
committerslewis2016-01-09 17:08:47 +0000
commit9fac2c44de7488c540651bd0361a279f887389cc (patch)
treea8a1673e0a1063b95ed3cec6d7bb22aa0e6513c5 /framework
parent24b2da5c47fe3585e3ae1e58e971531f612d32ed (diff)
downloadorg.eclipse.ecf-9fac2c44de7488c540651bd0361a279f887389cc.tar.gz
org.eclipse.ecf-9fac2c44de7488c540651bd0361a279f887389cc.tar.xz
org.eclipse.ecf-9fac2c44de7488c540651bd0361a279f887389cc.zip
Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=472973 as per
Diffstat (limited to 'framework')
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/IServiceInfoServiceListener.java77
2 files changed, 41 insertions, 38 deletions
diff --git a/framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF
index a126d7ab6..b97d376d1 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.discovery;singleton:=true
-Bundle-Version: 5.0.0.qualifier
+Bundle-Version: 5.0.100.qualifier
Bundle-Activator: org.eclipse.ecf.internal.discovery.DiscoveryPlugin
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/IServiceInfoServiceListener.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/IServiceInfoServiceListener.java
index 9af6d9fad..ca66ae3d2 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/IServiceInfoServiceListener.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/IServiceInfoServiceListener.java
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.ecf.internal.discovery;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.discovery.*;
import org.eclipse.ecf.discovery.identity.*;
@@ -25,35 +27,42 @@ public class IServiceInfoServiceListener {
private final ServiceTracker serviceTracker;
+ void logException(String message, Throwable t) {
+ DiscoveryPlugin.getDefault().log(new Status(IStatus.ERROR, DiscoveryPlugin.PLUGIN_ID, message, t));
+ }
+
public IServiceInfoServiceListener(final IDiscoveryAdvertiser advertiser) {
- final BundleContext bundleContext = DiscoveryPlugin.getDefault()
- .getBundleContext();
- serviceTracker = new ServiceTracker(bundleContext, IServiceInfo.class,
- new ServiceTrackerCustomizer() {
+ final BundleContext bundleContext = DiscoveryPlugin.getDefault().getBundleContext();
+ serviceTracker = new ServiceTracker(bundleContext, IServiceInfo.class, new ServiceTrackerCustomizer() {
- public Object addingService(ServiceReference reference) {
- final IServiceInfo serviceInfo = (IServiceInfo) bundleContext
- .getService(reference);
- final IServiceInfo specific = convertToProviderSpecific(
- advertiser, serviceInfo);
- advertiser.registerService(specific);
- return serviceInfo;
- }
+ public Object addingService(ServiceReference reference) {
+ final IServiceInfo serviceInfo = (IServiceInfo) bundleContext.getService(reference);
+ try {
+ advertiser.registerService(convertToProviderSpecific(advertiser, serviceInfo));
+ } catch (Exception e) {
+ logException("Advertiser.registerService failed", e);
+ }
+ return serviceInfo;
+ }
- public void modifiedService(ServiceReference reference,
- Object service) {
- // TODO discovery containers might require to
- // unregisterService first
- advertiser.registerService(convertToProviderSpecific(
- advertiser, (IServiceInfo) service));
- }
+ public void modifiedService(ServiceReference reference, Object service) {
+ // TODO discovery containers might require to
+ // unregisterService first
+ try {
+ advertiser.registerService(convertToProviderSpecific(advertiser, (IServiceInfo) service));
+ } catch (Exception e) {
+ logException("Advertiser.modifiedService failed", e);
+ }
+ }
- public void removedService(ServiceReference reference,
- Object service) {
- advertiser.unregisterService(convertToProviderSpecific(
- advertiser, (IServiceInfo) service));
- }
- });
+ public void removedService(ServiceReference reference, Object service) {
+ try {
+ advertiser.unregisterService(convertToProviderSpecific(advertiser, (IServiceInfo) service));
+ } catch (Exception e) {
+ logException("Advertiser.removedService failed", e);
+ }
+ }
+ });
serviceTracker.open();
}
@@ -63,8 +72,7 @@ public class IServiceInfoServiceListener {
* specific one. This is required so that discovery providers can correctly
* advertise services.
*/
- private IServiceInfo convertToProviderSpecific(
- final IDiscoveryAdvertiser advertiser,
+ private IServiceInfo convertToProviderSpecific(final IDiscoveryAdvertiser advertiser,
final IServiceInfo genericInfo) {
// Convert similar to
@@ -73,18 +81,13 @@ public class IServiceInfoServiceListener {
final Namespace servicesNamespace = advertiser.getServicesNamespace();
final IServiceID genericServiceID = genericInfo.getServiceID();
- final ServiceID specificServiceID = (ServiceID) servicesNamespace
- .createInstance(new Object[] {
- genericServiceID.getServiceTypeID().getName(),
- genericServiceID.getLocation() });
+ final ServiceID specificServiceID = (ServiceID) servicesNamespace.createInstance(
+ new Object[] { genericServiceID.getServiceTypeID().getName(), genericServiceID.getLocation() });
- final IServiceTypeID serviceTypeID = specificServiceID
- .getServiceTypeID();
+ final IServiceTypeID serviceTypeID = specificServiceID.getServiceTypeID();
- return new ServiceInfo(genericServiceID.getLocation(),
- genericInfo.getServiceName(), serviceTypeID,
- genericInfo.getPriority(), genericInfo.getWeight(),
- genericInfo.getServiceProperties());
+ return new ServiceInfo(genericServiceID.getLocation(), genericInfo.getServiceName(), serviceTypeID,
+ genericInfo.getPriority(), genericInfo.getWeight(), genericInfo.getServiceProperties());
}
public void dispose() {

Back to the top