[MAGNOLIA-2040] Resource.getLocalContentNode() causes unexpected NullPointerException Created: 04/Feb/08 Updated: 02/Dec/13 Resolved: 02/Dec/13 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | templating |
| Affects Version/s: | 3.5.3, 3.5.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Vincent Faidherbe | Assignee: | Philipp Bärfuss |
| Resolution: | Outdated | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows XP, Java 1.5, Tomcat 5.5.25 |
||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Description |
|
The following code doesn't work. It causes a NullPointException : <cms:contentNodeIterator items="${sectionArticles}"> <cms:includeTemplate /> <% Content parent = Resource.getLocalContentNode().getAncestor(3); %> <p class="blogline blogfoot"><span class="blogitem">Rubrique: <a href="<%= request.getContextPath() + parent.getHandle()+".html"%>"><%= parent.getTitle() %></a></span></p> </cms:contentNodeIterator> It appears that Resource.getLocalContentNode() returns null when call after a <cms:includeTemplate /> tag because the following code works fine: <cms:contentNodeIterator items="${sectionArticles}"> <% Content parent = Resource.getLocalContentNode().getAncestor(3); %> <cms:includeTemplate /> <p class="blogline blogfoot"><span class="blogitem">Rubrique: <a href="<%= request.getContextPath() + parent.getHandle()+".html"%>"><%= parent.getTitle() %></a></span></p> </cms:contentNodeIterator> |