Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Alexander Kuppe2013-01-24 17:47:48 +0000
committerMarkus Alexander Kuppe2013-01-24 17:47:48 +0000
commitd960664b31d44a667ab2c54297a3f819827df518 (patch)
tree011e19aeea80f4c5f44dee7bec38605f55a12267
parent03d63de7cfcb1097491acc5038ab417aab7ec87e (diff)
downloadorg.eclipse.ecf-d960664b31d44a667ab2c54297a3f819827df518.tar.gz
org.eclipse.ecf-d960664b31d44a667ab2c54297a3f819827df518.tar.xz
org.eclipse.ecf-d960664b31d44a667ab2c54297a3f819827df518.zip
NEW - bug 397877: [slp] Invalid service type causes unhandled exception
to be thrown https://bugs.eclipse.org/bugs/show_bug.cgi?id=397877 - Guarding against invalid service type wth try/catch stmt, essentially dropping invalid ones
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java
index a21953e39..0b4d6f4a7 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java
@@ -13,6 +13,7 @@ package org.eclipse.ecf.internal.provider.jslp;
import ch.ethz.iks.slp.*;
import java.util.*;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.ecf.core.util.Trace;
/**
* This decorator add additional methods which will eventually be moved to jSLP itself
@@ -77,10 +78,17 @@ public class LocatorDecoratorImpl implements LocatorDecorator {
final List result = new ArrayList();
for (final Iterator itr = aSet.iterator(); itr.hasNext();) {
final String type = (String) itr.next();
- final ServiceLocationEnumeration services = findServices(new ServiceType(type), scopes, null);
- while (services.hasMoreElements()) {
- final ServiceURL url = (ServiceURL) services.next();
- result.add(url);
+ try {
+ final ServiceLocationEnumeration services = findServices(new ServiceType(type), scopes, null);
+ while (services.hasMoreElements()) {
+ final ServiceURL url = (ServiceURL) services.next();
+ result.add(url);
+ }
+ } catch (IllegalArgumentException e) {
+ // Skipping an invalid service type
+ // @see https://bugs.eclipse.org/397877
+ Trace.catching(Activator.PLUGIN_ID, JSLPDebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "getServiceURLs(String, List)", e); //$NON-NLS-1$
+ continue;
}
}
return result;
@@ -108,10 +116,17 @@ public class LocatorDecoratorImpl implements LocatorDecorator {
final Map result = new HashMap();
for (final Iterator itr = aSet.iterator(); itr.hasNext();) {
final String type = (String) itr.next();
- final ServiceLocationEnumeration services = findServices(new ServiceType(type), null, null);
- while (services.hasMoreElements()) {
- final ServiceURL url = (ServiceURL) services.next();
- result.put(url, Collections.list(findAttributes(url, null, null)));
+ try {
+ final ServiceLocationEnumeration services = findServices(new ServiceType(type), null, null);
+ while (services.hasMoreElements()) {
+ final ServiceURL url = (ServiceURL) services.next();
+ result.put(url, Collections.list(findAttributes(url, null, null)));
+ }
+ } catch (IllegalArgumentException e) {
+ // Skipping an invalid service type
+ // @see https://bugs.eclipse.org/397877
+ Trace.catching(Activator.PLUGIN_ID, JSLPDebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "getServiceURLs()", e); //$NON-NLS-1$
+ continue;
}
}
return result;

Back to the top