-
Bug
-
Resolution: Fixed
-
Major
-
Jenkins 2.281+
-
-
Maven Plugin 3.10
After a recent update of Jenkins and all plugins we encountered this exception in multiple jobs:
ERROR: Processing failed due to a bug in the code. Please report this to the issue tracker (https://jenkins.io/redirect/report-an-issue). java.lang.NullPointerException at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006) at java.base/java.util.Properties.put(Properties.java:1337) at hudson.maven.MavenModuleSetBuild$PomParser.<init>(MavenModuleSetBuild.java:1171) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:985) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:689) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:513) at hudson.model.Run.execute(Run.java:1907) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) project=hudson.maven.MavenModuleSet@409eb7a3[...]
Resolving this proved to be quite difficult, but we finally found out that Jenkins seems to remove the <defaultValue></defaultValue> entry of a <hudson.model.StringParameterDefinition> in the config.xml upon save when the default value is empty.
This triggers the exception. After manually reverting the deletion and reloading the config via the Jenkins GUI, the job is able to run again.
The same happens for each <hudson.model.ChoiceParameterDefinition> without a default value, but there the element seems to be optional during execution as it triggers no exception.
- relates to
-
JENKINS-65066 pipeline/freestylejob cannot get empty param value
-
- Open
-
- links to
Cause: https://github.com/jenkinsci/maven-plugin/blame/9af6b016d56823200f1a614b3a22fcbce03f7f40/src/main/java/hudson/maven/MavenModuleSetBuild.java#L1171 . The code in the plugin was last updated 10 years ago, and indeed there is an expectation that the default value is never null.
https://github.com/jenkinsci/jenkins/commit/8152129c731472c30fde53618f3ec6e7f3c1c5a6#diff-e4f52968c7be6106c2db6b72f0acc9c47e34ef075593f20082cbf1bad59bab35 from jglick added "Util.fixEmpty()" to the databound setter. After that empty values become null. Nullness of getDefaultValue() is not defined in Javadoc, so it may definitely come as a surprise to end users and plugin developers. Better to handle it as a regression