Section | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Panel | |||||||
---|---|---|---|---|---|---|---|
Test a script that returns the sum of two number fields:
|
...
- Identify the problem, from the
Message
that displayed a null pointer exception error and theStack
that displayed the line number on which the error occurred. Correct the problem, checking for null values and then returning the result.
In the Groovy editor, write the following lines of code:
Code Block language groovy linenumbers true if (issue.get("customfield_10028") == null || issue.get("customfield_10006") == null) return null; else return issue.get("customfield_10028") + issue.get("customfield_10006");
- Click on
Test again
. The following result is displayed:
...