开发者

Velocity lexical error when commenting out a line at file end

开发者 https://www.devze.com 2023-04-11 21:19 出处:网络
I have the following Velocity template in JIRA (note, extra lines kept in): NOTE: Please REPLY-TO this email when replying to this issue.

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.


~/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..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号