[MGNLSTK-1523] InternalLinkModel#getLinkTitle() throws NullPointerException when teaser target does not exist Created: 15/Feb/16 Updated: 09/Dec/16 Resolved: 08/Dec/16 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | None |
| Affects Version/s: | 2.9.3 |
| Fix Version/s: | 2.9.6, 3.0.1 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Nils Breunese | Assignee: | Ilgun Ilgun |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Template: |
|
||||
| Acceptance criteria: |
Empty
|
||||
| Date of First Response: | |||||
| Sprint: | Basel 73 | ||||
| Story Points: | 2 | ||||
| Description |
|
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 |
| Comments |
| Comment by Nils Breunese [ 16/Sep/16 ] |
|
The problem seems to be line 79 of InternalLinkModel, which says pageName = getLinkNode().getName(); and there are some situations in which getLinkNode() returns null, which causes a NullPointerException on this line. |