Details
-
Bug
-
Status: Done
-
Low
-
Resolution: Done
-
5.9.1-p5
-
SR4J Sprint 90
-
1.8
Description
Problem
We will show an error like this in the Script registry for Listeners:
No such property: issue for class: java.lang.Object
when the users refer to a property hanging off the event object because the registry does not seem to understand that the event object, in this case, is an IssueEvent which does have an issue property. So the error is not correct for the context of this listener.
This can make users think their scripts are wrong when they are not if they use the Script registry to check for errors. The listener itself will show a green tick for this script:
Steps to reproduce:
- Make a custom script listener that listens for the Issue Created and Issue Updated event with this code in a script file under the <ScriptRoots>/scripts/listener/my_listener_script.groovy
package listener import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue def issue = event.issue as MutableIssue
- Refer to the script as a file instead of inline and save the listener
- The listener will show green when checking the code
- Run the Script registry built-in script and look for the error reported for this specific listener which should be: "No such property: issue for class: java.lang.Object"
Notes:
Using the script inline has the same error as well:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue def issue = event.issue as MutableIssue