Velocity 1.7-有时Directive.postRender在Velocity.evaluate中抛出NullPointerException

问题描述 投票:0回答:1

我在使用Velocity模板时遇到了一个问题。它为我的模板中使用的foreach函数的NullPointerException抛出了Directive.postRender

奇怪的行为

是使用完全相同的模板和相同的输入数据,Velocity成功地能够完成评估过程。 失败说出百分之一。

任何人都可以分享见解吗?预先感谢!

Version

:速度1.7
java.lang.NullPointerException: null
    at org.apache.velocity.runtime.directive.Directive.postRender(Directive.java:202) ~[velocity-1.7.jar:1.7]
    at org.apache.velocity.runtime.directive.Foreach.clean(Foreach.java:489) ~[velocity-1.7.jar:1.7]
    at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:443) ~[velocity-1.7.jar:1.7]
    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207) ~[velocity-1.7.jar:1.7]
    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) ~[velocity-1.7.jar:1.7]
    at org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1378) ~[velocity-1.7.jar:1.7]
    at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1314) ~[velocity-1.7.jar:1.7]
    at org.apache.velocity.app.Velocity.evaluate(Velocity.java:254) ~[velocity-1.7.jar:1.7]

我在使用Velocity模板时遇到了一个问题。它为我的模板中使用的foreach函数抛出了Directive.postRender的NullPointerException。奇怪的行为是使用...

java velocity
1个回答
0
投票

通过使用Velocity.init()更改代码来设法解决到

© www.soinside.com 2019 - 2024. All rights reserved.