Details
-
Bug
-
Status: Done
-
High
-
Resolution: Fixed
-
4.1.3.24
-
None
-
Sprint 31 - Ends July 11, Sprint 31 - Ends July 25
-
0.8
Description
Steps to reproduce
1. Create a scripted field and set in it's configuration one Project (JRA) and one issue type (Bug)
(Searcher and template can be free text)
2. For the scripted field's script use
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import java.text.SimpleDateFormat Issue issue = issue // a Date picker custom field def dateCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Date Picker CF") def date = issue.getCustomFieldValue(dateCF) SimpleDateFormat format = new SimpleDateFormat("y-M-d hh:mm") Date startDate = format.parse(date?.toString()) return "<br><b>Hello world ${startDate}</b>"
3. Navigate to an issue in a project different than JRA - everything is fine
Navigate to an issue in project JRA and issue type task and you will get an error in your logs
2017-02-17 14:45:55,533 http-bio-2990-exec-12 ERROR admin 885x31576x1 1572f39 127.0.0.1 /secure/AjaxIssueAction.jspa [onresolve.scriptrunner.customfield.GroovyCustomField] Script field failed on issue: TSF-2, field: Test SF java.lang.NullPointerException at java_text_DateFormat$parse.call(Unknown Source) at myExampleScripts.bar.run(bar.groovy:13)
This should not happen because the issue type task is not in the scripted field's Available Context(s).
Affects versions:
6.4.*
7.0.0
7.3.1