[ 
http://jira.magnolia-cms.com/browse/MAGNOLIA-2498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=29922#action_29922
 ] 

Arjan van Bentem commented on MAGNOLIA-2498:
--------------------------------------------

For what it's worth: a quick and dirty way to avoid the above error, and 
similar errors in {{<cms:setNode>}}, in Magnolia 4.3.5:

{code}
Content content = ContentUtil.getContent(ContentRepository.WEBSITE, handle);
MgnlContext.getAggregationState().setCurrentContent(content);
MgnlContext.getAggregationState().setMainContent(content);
{code}

Our use case is the same as Martin's: we're using some JSP fragments that fetch 
generic content from Magnolia, like to render a menu or a sitemap, or content 
based on JCR queries. These fragments are neither paragraphs nor pages. They 
are included in our own page templates, but also in non-Magnolia websites 
(served by a Spring controller). 

I could imagine that a "Latest headlines" component, that serves a HTML 
fragment to whatever website likes to include it, might be a similar use case.

(When (ab)using {{BlossomDispatcherServlet}} for plain Spring controllers as 
well, one also needs to invoke {{RenderContext.push()}}, to avoid an 
{{IllegalStateException}}.)

> NPE in <cms:out> (Out.java)
> ---------------------------
>
>                 Key: MAGNOLIA-2498
>                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-2498
>             Project: Magnolia
>          Issue Type: Bug
>          Components: taglibs
>            Reporter: Martin Algesten
>            Assignee: Fabrizio Giustina
>
> I've mapped up cms bypasses so that struts pages (*.do) are not handled by 
> Magnolia. Note that my bypass is in "cms" in the filter chain, I do want all 
> of the Magnolia chain, but not the actual content (since I'm generating 
> navigation elements that depends on the Magnolia context being in place).
> So the below error occurs since we're currently looking at a URL and using 
> <cms:out> on a jsp page that is not generated by Magnolia.
> The tag that fails is:
> <cms:out nodeDataName="title"/>
> 2008-12-08 09:19:14.078::WARN:  /pbWebapp/common/welcome.do
> java.lang.NullPointerException
>       at info.magnolia.cms.taglibs.Out.doEndTag(Out.java:374)
>       at 
> org.apache.jsp.common.welcome_jsp._jspx_meth_cms_out_2(org.apache.jsp.common.welcome_jsp:1938)
>       at 
> org.apache.jsp.common.welcome_jsp._jspx_meth_c_if_1(org.apache.jsp.common.welcome_jsp:1821)
>       at 
> org.apache.jsp.common.welcome_jsp.access$2(org.apache.jsp.common.welcome_jsp:1785)
> Since there is no current Magnolia page, Resource.getActivePage() returns 
> null which means getHandle() is causing the NPE. 
> I have implemented the obvious quick fix but I wonder if it's correct. It 
> just bypasses the UUID resolving if Resource.getActivePage() is null. However 
> I suspect one would really want the resolving to happen also when there is no 
> current active page - thoughts?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to