Hi, I need to update a velocity template for a plugin that currently uses the following code
#disable_html_escaping() #if ($value) #set ($numberTool = $ctx.getClass().forName("com.atlassian.jira.util.velocity.NumberTool").newInstance()) #set ($format = $numberTool.getFormat()) #if ($urlPrefix && $urlPrefix != '') <a href="${urlPrefix}">$!numberTool.format( $format, $value, $authcontext.getLocale() )</a> #else $!numberTool.format( $format, $value, $authcontext.getLocale() ) #end #end
In JIRA 8.11.0 this gives an error
[velocity] Cannot retrieve method forName from object of class java.lang.Class due to security restrictions.
This is because the security restrictions have been increased to prevent the getClass function working.
This is the same as this issue on Confluence
https://jira.atlassian.com/browse/CONFSERVER-59935
I’m struggling to replace the velocity code to allow me to use NumberTool, or at least convert the double value being sent in to an integer.
I end up with the same issue as this question
How can I now use the NumberTool class in a Velocity template?