Unable to render Object reference in Velocity template in Jira 10.5.0 version

For the code snippet below, I am not able to render the value in the object reference in Jira 10.5.0 version; “$execStatus.name” is being rendered in the UI as a string and it is not able to load the value inside the Object reference.
Note:

  1. The object is not empty I have verified from the backend
  2. Tried fetching the data via getter method of the Model class
  3. Also tried updating the fugue dependency in pom.xl that also didn’t work
  4. Converted the ArrayList to a Map and then tried rendering it that also didn’t work

Checked in the previous versions its working as expected. I could not find anything in the release notes as well specific to this issue. Its a Blocker can someone help me with this as its breaking the apps functionality.

Code :

#foreach($execStatus in $action.stepExecutionStatusList)

$execStatus.name
$execStatus.description


        <td>
            <ul class="operations-list">
                    <li><a href="EditZephyrTestStepStatus!default.jspa?id=$execStatus.id">$i18n.getText("common.words.edit")</a></li>
				#if($execStatus.type == 1)
                    <li><a href="DeleteZephyrTestStepStatus!default.jspa?id=$execStatus.id&amp;name=$execStatus.name">$i18n.getText("common.words.delete")</a></li>
    		    #end
            </ul>
        </td>
	</tr>
#end

Hi @aakashshaw ,
You should add allow-list to your atlassian-plugin.xml i.e.

<velocity-allowlist key="velocity-allowlist" name="Velocity Allowlist">
    <!--  here is your models  -->
    <method>com.some.company.jira.model.StepExecutionStatusModel#getName()</method>
    <method>com.some.company.jira.model.StepExecutionStatusModel#getDescription()</method>
    ...etc
</velocity-allowlist>

More info and details you can find here

1 Like

Hi @RostykChuma1 I have tried the solution and added it to the Velocity-allowlist in atlassian-pulgin.xml its not working and it s still giving the same result

Were you able to resolve this issue? @aakashshaw

Hi @nikithacholleti this error is resolved no queries thank you for the follow up.

Hey @aakashshaw We are going through the same error, could you please let me know how you were able to resolve this?
We already tried using the <velocity-allowlist key="velocity-allowlist" name="Velocity Allowlist"> but are still facing the same issue.
Thankyou.

We were able to overcome this issue when “-Datlassian.velocity.method.allowlist.debug=true” is added to set-env configuration.
May I know if there is any other way that you have tried to overcome this issue?

Hi @nikithacholleti we have to check if the velocity allowlist every function that we have listed is correct as per the latest way of rendering velocity template, you can check the documentation in release notes. Earlier it ignored as a warning but even if a single velocity method is not loaded correctly it will not work

Okay, Thankyou.

Hey @aakashshaw, Is there any way to find what methods have been missed in allow-list? Is there any logs that we can look into which might help us?

Hi
You could use grep, if this is enough and you’re on Linux

grep "\[velocity\] DEBUG MODE" atlassian-jira.log

Hello @andrea.schneider,
Thank you for your comment. We were able to isolate and resolve the issue prior to your response.
But, I appreciate your repsonse.

Hi @nikithacholleti
Good for you! Adding the methods to the still doesn’t work for me. May I ask, did you add the methods exactly as they were written in the log? I’m actually on version 10.6.0.

Hello @andrea.schneider
Yes, I have added the methods that were printed in the log statements to the allow-list. Although, for us a previous method which we added was blocking and disabling the use of velocity list, we isolated and removed that issue. Additionally, we added the methods that were being printed in the logs.
This helped us overcome the error. Also, it does not matter if you’re on version 10.5 or 10.6 as the breaking changes start from the v10.5.x.
Hope it helps you!