Details
-
Bug
-
Resolution: Timed out
-
Low
-
None
-
4.1.1
-
4.01
-
Severity 3 - Minor
-
-
Description
Just add a Text Field (< 255 characters) custom field and configure it for Default Screen.
Then try creating an issue. Insert -1 into this custom field.
Submit page.
This custom field is empty. Your -1 was ignored.
Reason:
com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister#createValuesInt
private void createValuesInt(CustomField field, Long issueId, PersistenceFieldType persistenceFieldType, Collection values, String parentKey) { if (values == null) return; for (Iterator iterator = values.iterator(); iterator.hasNext();) { Object value = iterator.next(); if (value == null || "".equals(value) || "-1".equals(value)) continue; // we don't create null values in the database Map entityFields = new HashMap(); entityFields.put(ENTITY_ISSUE_ID, issueId); entityFields.put(ENTITY_PARENT_KEY, parentKey); entityFields.put(ENTITY_CUSTOMFIELD_ID, CustomFieldUtils.getCustomFieldId(field.getId())); entityFields.put(getColumnName(persistenceFieldType), value); delegator.createValue(TABLE_CUSTOMFIELD_VALUE, entityFields); } }
Please notice "-1".equals(value).
I wonder if we can do anything about it... Does anyone knows why "-1" are ignored? I bet it has some dark historical background
This problem was actually spotted while developing some other custom fields persisted as text. Sometimes getDbValueFromObject() for such custom field wanted to return "-1" string so that this very value is persisted into DB, but then the value was lost.
Attachments
Issue Links
- duplicates
-
JRASERVER-44457 Unable to set "-1" string value in text field custom field
- Gathering Impact