You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
I am using the Extensible Choice Parameter plugin and one of the parameters uses a Groovy script which tries to read the default values of another (hidden) parameter using the getParameters() method.
This throws a NullPointerException. Here is the relevant part of the stack trace:
Sep 04, 2014 4:03:15 PM jp.ikedam.jenkins.plugins.extensible_choice_parameter.SystemGroovyChoiceListProvider getChoiceList
Warnung: Failed to execute script
java.lang.NullPointerException
at hudson.plugins.project_inheritance.projects.inheritance.InheritanceGovernor.getVersionedField(InheritanceGovernor.java:115)
at hudson.plugins.project_inheritance.projects.inheritance.InheritanceGovernor.retrieveFullyDerivedField(InheritanceGovernor.java:182)
at hudson.plugins.project_inheritance.projects.InheritanceProject.getAllProperties(InheritanceProject.java:2818)
at hudson.plugins.project_inheritance.projects.InheritanceProject.getProperty(InheritanceProject.java:2953)
at hudson.plugins.project_inheritance.projects.InheritanceProject.getParameters(InheritanceProject.java:3029)
at hudson.plugins.project_inheritance.projects.InheritanceProject.getParameters(InheritanceProject.java:3025)
at hudson.plugins.project_inheritance.projects.InheritanceProject$getParameters.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java:75)
at Script1.run(Script1.groovy:4)
The problem occurrs because InheritanceGovernor calls InterhitanceProject.getVersionedObjectStore() (in getVersionedField()) but that returns null at that time. Since the project is not transient, the versionStore should not be null.
I tried calling onLoad(null, null) before getParameters() which seems to initialize the versionStore, although it throughs an IllegalStateException:
java.lang.IllegalStateException: no parent set on hudson.plugins.project_inheritance.projects.InheritanceProject[null]
at hudson.model.AbstractItem.getParent(AbstractItem.java:170)
at hudson.model.AbstractItem.getRootDir(AbstractItem.java:161)
at hudson.plugins.project_inheritance.projects.InheritanceProject.getRootDir(InheritanceProject.java:952)
at hudson.model.Job.getNextBuildNumberFile(Job.java:255)
at hudson.model.Job.onLoad(Job.java:172)
at hudson.model.AbstractProject.onLoad(AbstractProject.java:301)
at hudson.model.Project.onLoad(Project.java:90)
at hudson.plugins.project_inheritance.projects.InheritanceProject.onLoad(InheritanceProject.java:933)
at hudson.model.Item$onLoad.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at Script1.run(Script1.groovy:5)
Interestingly, this happens only on the "Build with parameters" page and not in the Jenkins script console or on the "Configure" page (it is possible to test the script there).
So the questions is:
Why is the versionStore not correctly initialized when showing the "Build with parameters" page? And can this be fixed?
And for a possible workaround:
What are the correct parameters to pass to onLoad()? I tried getParent() and getName() but getParent() returns null as well.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am using the Extensible Choice Parameter plugin and one of the parameters uses a Groovy script which tries to read the default values of another (hidden) parameter using the
getParameters()
method.This throws a NullPointerException. Here is the relevant part of the stack trace:
The problem occurrs because InheritanceGovernor calls
InterhitanceProject.getVersionedObjectStore()
(in getVersionedField()) but that returnsnull
at that time. Since the project is not transient, the versionStore should not benull
.I tried calling
onLoad(null, null)
beforegetParameters()
which seems to initialize the versionStore, although it throughs an IllegalStateException:Interestingly, this happens only on the "Build with parameters" page and not in the Jenkins script console or on the "Configure" page (it is possible to test the script there).
So the questions is:
And for a possible workaround:
onLoad()
? I triedgetParent()
andgetName()
butgetParent()
returnsnull
as well.The text was updated successfully, but these errors were encountered: