Uploaded image for project: 'Magnolia Standard Templating Kit (closed)'
  1. Magnolia Standard Templating Kit (closed)
  2. MGNLSTK-1523

InternalLinkModel#getLinkTitle() throws NullPointerException when teaser target does not exist

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 2.9.6, 3.0.1
    • 2.9.3
    • None
    • None
    • Basel 73
    • 2

      Trying to render a page with an internal teaser that points to a node that can't be found (page that is not published or has been deleted) results in a very long stack trace in the log with a NullPointerException in InternalLinkModel as the root cause:

      ERROR  freemarker.runtime 15.02.2016 18:27:47 -- Error executing FreeMarker template  /foutmeldingen/404.html
      FreeMarker template error:
      An error has occurred when reading existing sub-variable "linkTitle"; see cause exception! The type of the containing value was: extended_hash+string (info.magnolia.module.templatingkit.templates.components.InternalLinkModel wrapped into f.e.b.StringModel)
      
      ----
      FTL stack trace ("~" means nesting-related):
              - Failed at: ${model.linkTitle!}  [in template "vpro/vpronl/templates/components/paragraphs/internal-link.ftl" at line 1, column 69]
      ----
      
      Java stack trace (for programmers):
      ----
      freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
      (...)
      Caused by: java.lang.reflect.InvocationTargetException
              at sun.reflect.GeneratedMethodAccessor592.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:497)
              at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1385)
              at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:254)
              at freemarker.ext.beans.BeanModel.get(BeanModel.java:158)
              ... 247 more
      Caused by: java.lang.NullPointerException
              at info.magnolia.module.templatingkit.templates.components.InternalLinkModel.getLinkTitle(InternalLinkModel.java:79)
              ... 253 more
      

        Acceptance criteria

              ilgun Ilgun Ilgun
              breun Nils Breunese
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: