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

Using a custom multi-picker field Notify Users throws exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Handled by Support
    • Medium
    • None
    • 3.12.3
    • Issue - Fields

    Description

      This bug is similar to bug JRA-13523.
      The issue is the user created a custom multi-user picker field. When this field is called an error is thrown.

      In JRA-13523 there is a custom multipicker field used. When assign all users is selected an error is thrown:

      java.lang.IllegalArgumentException: Value:  must be a collection. Type not allowed: class java.lang.String
      	at com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType.getDefaultValue(AbstractMultiCFType.java:80)
      	at com.atlassian.jira.issue.fields.CustomFieldImpl.populateDefaults(CustomFieldImpl.java:463)
      

      In this case it is the same error but instead of ASSIGNING all users from the custom multi-picker field in this case it is NOTIFY all users.

      This was fixed in 3.12. I am thinking that a similar fix for JRA-13523 would also fix this problem. The fix was:
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      The MultiUserCFType needs to override the getValueFromIssue(CustomField field, Issue issue) method to return a Set rather than a List.

      Or, we could make the UserCF a little more robust and make the following method able to handle more than just a Set:

      public Set getUsers(PermissionContext ctx, String customFieldId)
      {
          if (ctx.getIssue() == null)
          {
              throw new IllegalArgumentException("PermissionContext has no issue");
          }
          Issue issue = ctx.getIssue();
          FieldManager fieldManager = ComponentManager.getInstance().getFieldManager();
          CustomField field = fieldManager.getCustomField(customFieldId);
      
          CustomFieldType type = field.getCustomFieldType();
      
          Object obj = type.getValueFromIssue(field, issue);
          Set users = new HashSet(1);
      
          if (obj != null)
          {
              if (obj instanceof Set)
              {
                  users = (Set) obj;
              }
              else
              {
                  users.add(obj);
              }
          }
          return users;
      }
      

      ---------------------------------------------------------------------------------------------------------------------------------

      To reproduce using the customers backup:

      1. Create issue
      2. Go into the TIA ITR's project
      3. Issue Type IT Request

      The error is thrown.

      Attachments

        Issue Links

          Activity

            People

              dushan@atlassian.com Dushan Hanuska [Atlassian]
              agoldman Andy Goldman [Atlassian]
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 3h
                  3h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h Time Not Required
                  1.5h