Integrated: 1291: NPE in org.openjdk.skara.issuetracker.Label.compareTo

Erik Joelsson erikj at openjdk.java.net
Mon Dec 20 22:47:59 UTC 2021


On Thu, 16 Dec 2021 22:37:01 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> Recently, we have started seeing NPEs being thrown in org.openjdk.skara.issuetracker.Label::compareTo when called from GitLabMergeRequest::links. This seems to be caused by adding of labels while the GitLabMergeRequest object is active. The labelNameToLabel map is initiated in the constructor based on the repository labels. This may get outdated while the GitLabMergeRequest instance is still alive. 
> 
> This patch makes the initialization of the map lazy by wrapping all calls to the map in a private method. The map is re-initialized any time an element isn't found in it. I also added a filter on null labels before the sorting to avoid the NPE in case it still slips through.

This pull request has now been integrated.

Changeset: 87d9845d
Author:    Erik Joelsson <erikj at openjdk.org>
URL:       https://git.openjdk.java.net/skara/commit/87d9845dc1c5ff957836c4ff42392602d523b587
Stats:     24 lines in 1 file changed: 17 ins; 4 del; 3 mod

1291: NPE in org.openjdk.skara.issuetracker.Label.compareTo

Reviewed-by: kcr

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

PR: https://git.openjdk.java.net/skara/pull/1264


More information about the skara-dev mailing list