Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-21930

"-1" string cannot be stored by custom field of Text Field (< 255 characters) type

    XMLWordPrintable

Details

    • 4.01
    • Severity 3 - Minor
    • Hide
      Atlassian Update – 16 November 2017

      Hi everyone,

      The issue has not collected enough votes, watches, comments or support cases during it's lifetime. In this sense overal interest in the reported problem is low.
      Jira team is focusing on bigger and more impactful issues at the moment and we are not likely to look at the current bug soon. Therefore I'm resolving the issue as Timed Out.

      Atlassian will continue to watch issue for the further updates, so please don't hesitate to share your feedback in the issue comments.

      Cheers,
      Ignat Alexeyenko
      Jira bugmaster.

      Show
      Atlassian Update – 16 November 2017 Hi everyone, The issue has not collected enough votes, watches, comments or support cases during it's lifetime. In this sense overal interest in the reported problem is low. Jira team is focusing on bigger and more impactful issues at the moment and we are not likely to look at the current bug soon. Therefore I'm resolving the issue as Timed Out . Atlassian will continue to watch issue for the further updates, so please don't hesitate to share your feedback in the issue comments. Cheers, Ignat Alexeyenko Jira bugmaster.

    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

          Activity

            People

              Unassigned Unassigned
              wseliga Wojtek Seliga (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: