From c4416e2ed7f30a4f3d8ae0c7d1e264b7585d007f Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Wed, 25 Apr 2012 09:54:39 +1000 Subject: [PATCH] 377492 NPE when deploying a Web Application Bundle with unresolved Require-TldBundle --- .../osgi/boot/internal/webapp/WebBundleDeployerHelper.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleDeployerHelper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleDeployerHelper.java index 67f5ccb17fd..b49949bd068 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleDeployerHelper.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/webapp/WebBundleDeployerHelper.java @@ -788,7 +788,7 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper context.setClassLoader(webappClassLoader); webappClassLoader.setWebappContext(webappCtxt); - String pathsToRequiredBundles = getPathsToRequiredBundles(context, requireTldBundle); + String pathsToRequiredBundles = getPathsToRequiredBundles(context, contributor, requireTldBundle); if (pathsToRequiredBundles != null) webappClassLoader.addClassPath(pathsToRequiredBundles); } else @@ -866,12 +866,11 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper } } - private String getPathsToRequiredBundles(ContextHandler context, String requireTldBundle) throws Exception + private String getPathsToRequiredBundles(ContextHandler context, Bundle bundle, String requireTldBundle) throws Exception { if (requireTldBundle == null) return null; StringBuilder paths = new StringBuilder(); - Bundle bundle = (Bundle) context.getAttribute(OSGiWebappConstants.JETTY_OSGI_BUNDLE); PackageAdmin packAdmin = getBundleAdmin(); DefaultFileLocatorHelper fileLocatorHelper = new DefaultFileLocatorHelper(); @@ -884,7 +883,7 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper + "' specified in the " + OSGiWebappConstants.REQUIRE_TLD_BUNDLE + " of the manifest of " - + bundle.getSymbolicName()); } + + (bundle==null?"unknown":bundle.getSymbolicName())); } File f = fileLocatorHelper.getBundleInstallLocation(bs[0]); if (paths.length() > 0)