| Issue: When trying to import a yaml with config as code, if that yml code has nested views then it will fail due to a Null pointer Steps to reproduce: 1. Create a view with nested views 2. Export that config as code yaml 3. Import the yaml and observe the null pointer The error:
java.lang.Error: java.lang.reflect.InvocationTargetException
at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110)
at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1095)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
... 8 more
Caused by: java.lang.NullPointerException
at hudson.plugins.nested_view.NestedView.save(NestedView.java:258)
at hudson.BulkChange.commit(BulkChange.java:98)
at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:272)
The cause: This is the code which causes the issue and it appears that the owner while doing an import does not exist. The fix: I think we should do a check there for "if no owner then the owner should be the default Jenkins instance. Thoughts? |