注释掉文件末尾的行时出现速度词法错误

发布于 2024-12-08 14:10:23 字数 2147 浏览 0 评论 0原文

我在 JIRA 中有以下 Velocity 模板(注意,保留了额外的行):

NOTE: Please REPLY-TO this email when replying to this issue.

##parse("templates/email/includes/issueplugins.vm")
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end


#if($remoteUser.fullName)
$i18n.getText("template.issue.commented.on", $remoteUser.fullName, $issue.getKey())
#dashes($!remoteUser.fullName)--------------#dashes($issue.getKey())-
#end
#if($changelog)

#changes([])
#end
#comment()
#visibility()

#parse("templates/email/text/includes/issuesummary.vm")

#parse("templates/email/text/includes/footer.vm")

最后一行后面没有任何行。我什么时候在最后一行执行此操作:

##parse("templates/email/text/includes/footer.vm")

我收到以下错误:

An error occurred whilst rendering this message.  Please contact the administrators, and inform them of this bug.

Details:
-------
org.apache.velocity.exception.ParseErrorException: Lexical error:
    org.apache.velocity.runtime.parser.TokenMgrError: 
        Lexical error at line 20, column 51.  Encountered: <EOF> after : ""
    at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:272)
    at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:202)
...

我发现了 2004 年的以下问题:

https://issues.apache.org/jira/browse/VELOCITY-272

这似乎表明这是 1.5 中修复的错误。检查我的 JIRA 系统信息,我发现 JIRA 4.2.1 似乎表明正在使用版本 1.6:

Atlassian 模板渲染器 Velocity 1.6 插件 - 1.1.1

当我将开始 #if($comment.getId()) 的行移至末尾时,错误消失。我在模板末尾做错了什么,还是这是一个错误?

编辑

嗯。当我这样做时:

#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end

作为最后一行,后面没有空行,我得到了同样的错误。但是,如果我在该行之后添加一行(只需按 ENTER 一次),它就会起作用。

Velocity 模板需要结尾空格吗?我很困惑。

I have the following Velocity template in JIRA (note, extra lines kept in):

NOTE: Please REPLY-TO this email when replying to this issue.

##parse("templates/email/includes/issueplugins.vm")
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end


#if($remoteUser.fullName)
$i18n.getText("template.issue.commented.on", $remoteUser.fullName, $issue.getKey())
#dashes($!remoteUser.fullName)--------------#dashes($issue.getKey())-
#end
#if($changelog)

#changes([])
#end
#comment()
#visibility()

#parse("templates/email/text/includes/issuesummary.vm")

#parse("templates/email/text/includes/footer.vm")

There is no line following that last line. When do I this on the very last line:

##parse("templates/email/text/includes/footer.vm")

I get the following error:

An error occurred whilst rendering this message.  Please contact the administrators, and inform them of this bug.

Details:
-------
org.apache.velocity.exception.ParseErrorException: Lexical error:
    org.apache.velocity.runtime.parser.TokenMgrError: 
        Lexical error at line 20, column 51.  Encountered: <EOF> after : ""
    at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:272)
    at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:202)
...

I found the following issue from 2004:

https://issues.apache.org/jira/browse/VELOCITY-272

Which seems to suggest this was a bug fixed in 1.5. Checking in my JIRA System Info, I see that JIRA 4.2.1 appears to suggest version 1.6 is in use:

Atlassian Template Renderer Velocity 1.6 Plugin - 1.1.1

When I move the line starting #if($comment.getId()) to the end, the error goes away. Am I doing something wrong here at the end of the template, or is this a bug?

EDIT

Hmm. When I did this:

#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end

As the last line, with no empty line following it, I got the same error. However, if I add a line after that line (just hit ENTER once), it works.

Do Velocity template's require an ending space? I'm confused.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

口干舌燥 2024-12-15 14:10:23
~/tech/atlassian/atlassian-jira-4.4.1-standalone $ find . -name "*velocity*.jar"
./atlassian-jira/WEB-INF/lib/velocity-1.4-atlassian-9.jar
./atlassian-jira/WEB-INF/lib/velocity-tools-1.3.jar
./atlassian-jira/WEB-INF/lib/atlassian-velocity-0.8.jar

不,他们没有;请参阅几天前的讨论..

~/tech/atlassian/atlassian-jira-4.4.1-standalone $ find . -name "*velocity*.jar"
./atlassian-jira/WEB-INF/lib/velocity-1.4-atlassian-9.jar
./atlassian-jira/WEB-INF/lib/velocity-tools-1.3.jar
./atlassian-jira/WEB-INF/lib/atlassian-velocity-0.8.jar

And no, they haven't; see this discussion from a few days ago..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文