File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed
main/java/ru/mail/jira/plugins/groovy/impl/cf
test/java/it/ru/mail/jira/plugins/groovy Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 44 <modelVersion >4.0.0</modelVersion >
55 <groupId >ru.mail.jira.plugins</groupId >
66 <artifactId >groovy</artifactId >
7- <version >1.20.0 -jira8</version >
7+ <version >1.20.1 -jira8</version >
88 <organization >
99 <name >AtlasTeam</name >
1010 <url >https://atlasteam.ru/</url >
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ private <T> T doExtractValue(
201201 result = ((Number ) result ).doubleValue ();
202202 }
203203
204- if (!tType .isInstance (result )) {
204+ if (result != null && !tType .isInstance (result )) {
205205 logger .error ("Result type ({}) doesn't match field type {}" , result .getClass (), tType );
206206 }
207207 //todo: try to check collections in future if multi
Original file line number Diff line number Diff line change 2525import java .util .Set ;
2626import java .util .concurrent .TimeUnit ;
2727
28- import static org .junit .Assert .assertEquals ;
29- import static org .junit .Assert .assertNotNull ;
28+ import static org .junit .Assert .*;
3029
3130@ RunWith (Arquillian .class )
3231public class ScriptFieldIT {
@@ -107,6 +106,29 @@ public void scriptedFieldShouldWork() throws Exception {
107106 );
108107 }
109108
109+ @ Test
110+ public void nullValuesFieldShouldWork () throws Exception {
111+ this .field = fieldHelper .createNumberField ();
112+ this .issue = issueHelper .createIssue (userHelper .getAdmin (), project );
113+
114+ FieldConfig fieldConfig = fieldHelper .getFirstConfig (field );
115+
116+ assertNotNull (fieldConfig );
117+
118+ String script = "return null" ;
119+
120+ FieldConfigForm form = new FieldConfigForm ();
121+ form .setCacheable (true );
122+ form .setScriptBody (script );
123+ form .setVelocityParamsEnabled (false );
124+
125+ fieldConfigRepository .updateConfig (userHelper .getAdmin (), fieldConfig .getId (), form );
126+
127+ MutableIssue issue = issueManager .getIssueObject (this .issue .getId ());
128+
129+ assertNull (issue .getCustomFieldValue (field ));
130+ }
131+
110132 private boolean isIssueReIndexed (ApplicationUser expectedAssignee ) throws Exception {
111133 return issueHelper .search (
112134 userHelper .getAdmin (),
You can’t perform that action at this time.
0 commit comments