Skip to content

NPE when generating a changelog that includes a ported issue with no body #114

@jzheaux

Description

@jzheaux

When adding a forward-ported issue to the changelog, the code expects there to be a body:

if (labelNames.contains(portedIssue.getLabel())) {
	Pattern pattern = portedIssue.getBodyExpression();
	Matcher matcher = pattern.matcher(issue.getBody());
	// ...
}

Unfortunately, when the body is empty, issue.getBody() returns null causing Pattern#matcher to throw a NullPointerException.

While an empty body for forward-ported issues is uncommon, it can sometimes happen when entered manually.

The code seems to imply that it's not a problem if the pattern doesn't match, so it seems to be okay to check for null here with the same effect.

I'm happy to contribute a PR, if desired.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions