// sanity check
if (context == null || context.trim().equals("")) {
final String msg = "Context was null or the empty string.";
errorWithName(msg);
throw new PortletContainerException(msg);
}
// obtain the context of the portlet
ServletContext portletCtx = PortletContextManager.getPortletContext(servletContext, context);
if (portletCtx == null) {
final String msg = "Unable to obtain the servlet context for " +
"portlet context [" + context + "]. Ensure the portlet has " +
"been deployed and that cross context support is enabled.";
errorWithName(msg);
throw new PortletContainerException(msg);
}
// obtain the portlet application descriptor for the portlet
// context.
PortletAppDD portletAppDD = PortletDescriptorRegistry
.getRegistry()
.getPortletAppDD(portletCtx);
// we can't return null
if (portletAppDD == null) {
final String msg = "Obtained a null portlet application description for " +
"portlet context [" + context + "]";
errorWithName(msg);
throw new PortletContainerException(msg);
}
return portletAppDD;
}