NullPointerException on $searchResult.getObject() if the underlying object does not exist

Description

Stacktrace:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 2016-01-12 08:52:39,251 ERROR [http-bio-443-exec-31] [[Standalone].[localhost].[/].[default]] log Servlet.service() for servlet [default] in context with path [] threw exception com.k15t.scroll.runtime.confluence.content.transform.render.RenderingException: Failed to render template '/search.vm'. at com.k15t.scroll.viewport.infra.render.VelocityTemplateAdapter.render(VelocityTemplateAdapter.java:33) at com.k15t.scroll.viewport.theme.DefaultThemeTemplate.render(DefaultThemeTemplate.java:42) at com.k15t.scroll.viewport.request.AbstractViewportRequestHandler.render(AbstractViewportRequestHandler.java:133) at com.k15t.scroll.viewport.request.SearchRequestHandler.handle(SearchRequestHandler.java:54) at com.k15t.scroll.viewport.request.ViewportServletFilter$1.doInTransaction(ViewportServletFilter.java:196) at com.k15t.scroll.viewport.request.ViewportServletFilter$1.doInTransaction(ViewportServletFilter.java:170) ... at java.lang.Thread.run(Unknown Source) Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLink' in class com.k15t.scroll.viewport.api.placeholder.SearchResultPlaceholder threw exception java.lang.NullPointerException at /search.vm[line 153, column 69] at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262) at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:470) at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:62) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:85) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.Foreach.performIteration(Foreach.java:393) at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:316) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.Template.merge(Template.java:328) at org.apache.velocity.Template.merge(Template.java:235) at com.k15t.scroll.viewport.infra.render.VelocityTemplateAdapter.render(VelocityTemplateAdapter.java:30) ... 175 more Caused by: java.lang.NullPointerException at com.k15t.scroll.viewport.api.placeholder.SearchResultPlaceholder.getLink(SearchResultPlaceholder.java:135) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142) at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:533) at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198) ... 194 more

Environment

None

Status

Assignee

Jens Rutschmann (K15t)

Reporter

Jens Rutschmann (K15t)

Labels

Participants

None

Deployment

None

Components

Sprint

None

Fix versions

Priority

Major