[JENKINS-71957] Fix support for Java 21 #570
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
See JENKINS-71957.
When building the plugin with Java 17 and less, everything is fine but once building with Java 20+, there is a NPE occurring in the test.
This is because when testing with invalid setup, the exception is supposed to be printed out. However, the way the exceptions are printed changed. More specifically, the way a lock is acquired in order to print the exceptions. This should have no consequences on any code, as it is internal change of the JVM, but in the current plugin it creates a NPE are the object used to get the lock is a
mock
which is not properly initialized in the test class.Testing
I ran
mvn clean verify
with Java 17 an no issue happened.I ran
mvn clean verify
with both Java 20 and 21 and then bothJiraCreateReleaseNotesTest.failBuildOnErrorEmptyProjectKey
andJiraCreateReleaseNotesTest.failBuildOnErrorEmptyRelease
failed withWith this changest, this is not occuring anymore.
To run this and validate the changes, the new
Jenkinsfile
needs to be used, so a maintainer or an admin must re-open the pull request.馃毃 Please review the guidelines for contributing to this repository.