Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-2040

Resource.getLocalContentNode() causes unexpected NullPointerException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Outdated
    • Minor
    • None
    • 3.5.3, 3.5.4
    • templating
    • None
    • Windows XP, Java 1.5, Tomcat 5.5.25

    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>
      

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              pbaerfuss Philipp Bärfuss
              vfaid Vincent Faidherbe
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD