-
Bug
-
Resolution: Fixed
-
Low
-
4.1.1
-
4.01
-
I have developed a customfield, which adds error message not only with customfield id as key, but my own keys. (Basically I want to display an error only on a part of the customfield.)
Unfortunately, the following code throws a NPE, as the fieldId is not a valid customfield id. This leads to null being added to tabsWithErrors, which will throw a NPE in the end:
private void initTabsWithErrors() { tabsWithErrors = new TreeSet(); if (getErrors() != null && !getErrors().isEmpty()) { // Record the tabs which have fields with errors on them for (Iterator iterator = getErrors().keySet().iterator(); iterator.hasNext();) { String fieldId = (String) iterator.next(); tabsWithErrors.add(getFieldScreenRenderer().getFieldScreenRenderTabPosition(fieldId)); } // Add 1 as the status' counts in WW iterators start at 1 (not 0) selectedTab = ((FieldScreenRenderTab) tabsWithErrors.first()).getPosition() + 1; :
We need to patch JIRA to workaround this, which is always the second best solution. The fix is trivial and side-effect free, so I hope you can include this fix soon: :-D
private void initTabsWithErrors() { tabsWithErrors = new TreeSet(); if (getErrors() != null && !getErrors().isEmpty()) { // Record the tabs which have fields with errors on them for (Iterator iterator = getErrors().keySet().iterator(); iterator.hasNext();) { String fieldId = (String) iterator.next(); // Only add fieldScreenRenderTab if not null! FieldScreenRenderTab fieldScreenRenderTab = getFieldScreenRenderer().getFieldScreenRenderTabPosition(fieldId); if(fieldScreenRenderTab != null) { tabsWithErrors.add(fieldScreenRenderTab); } } // Add 1 as the status' counts in WW iterators start at 1 (not 0) selectedTab = ((FieldScreenRenderTab) tabsWithErrors.first()).getPosition() + 1; :
Thanks!
- is related to
-
JRASERVER-68022 java.util.NoSuchElementException when a Validator throws an InvalidInputException for the "comment" field
-
- Closed
-