Alex Herbert created MCHANGES-413:
-------------------------------------

             Summary: Jira report throws NPE when the resolution field is 
missing the "name" attribute
                 Key: MCHANGES-413
                 URL: https://issues.apache.org/jira/browse/MCHANGES-413
             Project: Maven Changes Plugin
          Issue Type: Bug
          Components: jira
    Affects Versions: 2.12.1
            Reporter: Alex Herbert


The `jira-report` goal throws a NullPointerException when the resolution 
JsonNode has no "name" attribute.

At Commons BCEL we had some tickets that were created from external issues. The 
priority field was set to an enum in [P0, P1, P2, P3, P4, P5]. See for example 
[BCEL-4|https://issues.apache.org/jira/projects/BCEL/issues/BCEL-4]. This field 
did not use the standard [Major, Minor, etc] and may have been a custom field. 
(The details of how these tickets were created is unknown.) The "standard" 
priority field was missing and the data downloaded by the 
\{{RestJiraDownloader}} had no "name" attribute for this node. Thus the NPE 
from this line:
{code:java}
// Note: val is not null here
issue.setPriority( val.get( "name" ).asText() );{code}
Patching the latest maven-changes-plugin to print all these offending tickets 
allowed them to be identified and corrected by adding a "standard" priority. In 
the example mentioned (BCEL-4) there are still two priority fields in the 
ticket.

Note that when the missing priority was ignored the Jira report completed 
successfully.

The solution is either:
 * Patch the RestJiraDownloader to be robust to this field missing the expected 
data
 * Label as not-a-bug because this field is mandatory and BCEL has somehow 
created invalid Jira tickets in the past



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to