-
Bug
-
Resolution: Fixed
-
High
-
3.10.2, 3.11 EAP
-
3.1
-
If a multi user custom field is added to JIRA, and the custom field is added to the Assignable User permission, the Assign Issue operation breaks, when trying to gather the list of assignable Users. This is basically because our MultiUserCF is not specific enough and relies to much on the AbstractMultiCFType.
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; }
Currently it can't, and the following exception is the result (a little further down the track, after the UserCF has added the wrong thing to the set of users):
java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.opensymphony.user.User at com.atlassian.core.user.BestNameComparator.compare(BestNameComparator.java:26) at java.util.Arrays.mergeSort(Arrays.java:1270) at java.util.Arrays.sort(Arrays.java:1210) at java.util.Collections.sort(Collections.java:159) at com.atlassian.jira.issue.fields.AssigneeSystemField.makeAssigneeOptionsList(AssigneeSystemField.java:416) at com.atlassian.jira.issue.fields.AssigneeSystemField.getAssigneeOptionsList(AssigneeSystemField.java:348) at com.atlassian.jira.issue.fields.AssigneeSystemField.getEditHtml(AssigneeSystemField.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:589) at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:61) at webwork.util.InjectionUtils.invoke(InjectionUtils.java:52) at webwork.util.ValueStack.findValue(ValueStack.java:426)
- is related to
-
JRASERVER-15175 Using a custom multi-picker field Notify Users throws exception
- Closed