377492 NPE when deploying a Web Application Bundle with unresolved Require-TldBundle

This commit is contained in:
Jan Bartel 2012-04-25 09:54:39 +10:00
parent 0d68272401
commit c4416e2ed7
1 changed files with 3 additions and 4 deletions

View File

@ -788,7 +788,7 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
context.setClassLoader(webappClassLoader); context.setClassLoader(webappClassLoader);
webappClassLoader.setWebappContext(webappCtxt); webappClassLoader.setWebappContext(webappCtxt);
String pathsToRequiredBundles = getPathsToRequiredBundles(context, requireTldBundle); String pathsToRequiredBundles = getPathsToRequiredBundles(context, contributor, requireTldBundle);
if (pathsToRequiredBundles != null) webappClassLoader.addClassPath(pathsToRequiredBundles); if (pathsToRequiredBundles != null) webappClassLoader.addClassPath(pathsToRequiredBundles);
} }
else 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; if (requireTldBundle == null) return null;
StringBuilder paths = new StringBuilder(); StringBuilder paths = new StringBuilder();
Bundle bundle = (Bundle) context.getAttribute(OSGiWebappConstants.JETTY_OSGI_BUNDLE);
PackageAdmin packAdmin = getBundleAdmin(); PackageAdmin packAdmin = getBundleAdmin();
DefaultFileLocatorHelper fileLocatorHelper = new DefaultFileLocatorHelper(); DefaultFileLocatorHelper fileLocatorHelper = new DefaultFileLocatorHelper();
@ -884,7 +883,7 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
+ "' specified in the " + "' specified in the "
+ OSGiWebappConstants.REQUIRE_TLD_BUNDLE + OSGiWebappConstants.REQUIRE_TLD_BUNDLE
+ " of the manifest of " + " of the manifest of "
+ bundle.getSymbolicName()); } + (bundle==null?"unknown":bundle.getSymbolicName())); }
File f = fileLocatorHelper.getBundleInstallLocation(bs[0]); File f = fileLocatorHelper.getBundleInstallLocation(bs[0]);
if (paths.length() > 0) if (paths.length() > 0)