diff options
author | Thomas Watson | 2012-04-30 15:18:06 +0000 |
---|---|---|
committer | Thomas Watson | 2012-04-30 15:18:06 +0000 |
commit | ca1d6ed9154dcfa26a0a46a39940fdfda2af2a52 (patch) | |
tree | 7f8b7d2b460da56b20c605916443b56eeec1b343 | |
parent | 29ef2e917202d1d4ece26ab34c8d08ce3dd8cb28 (diff) | |
download | rt.equinox.framework-ca1d6ed9154dcfa26a0a46a39940fdfda2af2a52.tar.gz rt.equinox.framework-ca1d6ed9154dcfa26a0a46a39940fdfda2af2a52.tar.xz rt.equinox.framework-ca1d6ed9154dcfa26a0a46a39940fdfda2af2a52.zip |
Bug 374230 - Failure to start a composite results in a
NullPointerException
2 files changed, 15 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/core/composite/org/eclipse/osgi/internal/composite/CompositeConfigurator.java b/bundles/org.eclipse.osgi/core/composite/org/eclipse/osgi/internal/composite/CompositeConfigurator.java index 90c86a99c..b545a0a70 100644 --- a/bundles/org.eclipse.osgi/core/composite/org/eclipse/osgi/internal/composite/CompositeConfigurator.java +++ b/bundles/org.eclipse.osgi/core/composite/org/eclipse/osgi/internal/composite/CompositeConfigurator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. + * Copyright (c) 2008, 2012 IBM Corporation and others. * 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 @@ -171,7 +171,14 @@ public class CompositeConfigurator implements SynchronousBundleListener, HookCon if ((data.getType() & (BundleData.TYPE_COMPOSITEBUNDLE | BundleData.TYPE_SURROGATEBUNDLE)) == 0) return null; // only create composite class loaders for bundles that are of type composite | surrogate - ClassLoaderDelegate companionDelegate = ((CompositeModule) ((CompositeBase) data.getBundle()).getCompanionBundle()).getDelegate(); + CompositeModule compositeModule = (CompositeModule) ((CompositeBase) data.getBundle()).getCompanionBundle(); + if (compositeModule == null) { + throw new IllegalStateException("Could not find companion bundle for " + data.getBundle()); + } + ClassLoaderDelegate companionDelegate = compositeModule.getDelegate(); + if (companionDelegate == null) { + throw new IllegalStateException("Could not find the companion bundle delegate for" + compositeModule); + } return new CompositeClassLoader(parent, delegate, companionDelegate, data); } diff --git a/bundles/org.eclipse.osgi/core/composite/org/eclipse/osgi/internal/composite/CompositeImpl.java b/bundles/org.eclipse.osgi/core/composite/org/eclipse/osgi/internal/composite/CompositeImpl.java index 807fb5bc7..021ee9e5a 100644 --- a/bundles/org.eclipse.osgi/core/composite/org/eclipse/osgi/internal/composite/CompositeImpl.java +++ b/bundles/org.eclipse.osgi/core/composite/org/eclipse/osgi/internal/composite/CompositeImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 IBM Corporation and others. + * Copyright (c) 2008, 2012 IBM Corporation and others. * 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 @@ -171,7 +171,11 @@ public class CompositeImpl extends CompositeBase implements CompositeBundle { protected void stopHook() throws BundleException { // bug 363561; need to make sure the class loader is created // before stopping the composite framework - checkClassLoader(); + try { + checkClassLoader(); + } catch (Throwable t) { + framework.publishFrameworkEvent(FrameworkEvent.ERROR, this, t); + } trackerManager.stoppedComposite(); // do not stop the framework unless we are persistently stopped if ((bundledata.getStatus() & Constants.BUNDLE_STARTED) == 0) |