Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2015-09-11 21:06:55 +0000
committerAlex Blewitt2015-09-11 21:06:55 +0000
commitbf37749bff9941ec20833ebaa8c4f77260df2b3e (patch)
tree396c8fbad169185eb8730654f68c141dfd15bf00 /bundles
parentd611bc7c8b5ec1f7ac7bf3d959255d78f584d03b (diff)
downloadrt.equinox.bundles-bf37749bff9941ec20833ebaa8c4f77260df2b3e.tar.gz
rt.equinox.bundles-bf37749bff9941ec20833ebaa8c4f77260df2b3e.tar.xz
rt.equinox.bundles-bf37749bff9941ec20833ebaa8c4f77260df2b3e.zip
When getURLConverter is called after the bundle has been shut down, a NullPointerException is generated because getBundleContext returns null. Handle this by explicitly testing the bundle context and return early instead of causing a NullPointerException. Change-Id: Ia3312d3255a054154947d56de8c3478a00804364 Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
index 19a35eb5..355ba8ad 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
@@ -315,6 +315,10 @@ public class Activator implements BundleActivator {
* find one.
*/
public static URLConverter getURLConverter(URL url) {
+ BundleContext ctx = getContext();
+ if (url == null || ctx == null) {
+ return null;
+ }
String protocol = url.getProtocol();
synchronized (urlTrackers) {
ServiceTracker<Object, URLConverter> tracker = urlTrackers.get(protocol);
@@ -324,7 +328,7 @@ public class Activator implements BundleActivator {
String FILTER_POSTFIX = "))"; //$NON-NLS-1$
Filter filter = null;
try {
- filter = getContext().createFilter(FILTER_PREFIX + protocol + FILTER_POSTFIX);
+ filter = ctx.createFilter(FILTER_PREFIX + protocol + FILTER_POSTFIX);
} catch (InvalidSyntaxException e) {
return null;
}

Back to the top