Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48157

AllView name migration fails if the primaryView name is null

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The API for primaryViewName is not documented at all AND not used in the plugins, but the improper call of the default constructor will cause the issue. It happens in the user creation reflection in my tests.

      This is a regression after JENKINS-38606 https://github.com/jenkinsci/jenkins/commit/fd2009a9712b8b0a8c310d687df07df60edbc8ad

      java.lang.IllegalArgumentException: Argument for @Nonnull parameter 'primaryView' of hudson/model/AllView.migrateLegacyPrimaryAllViewLocalizedName must not be null
      
      	at hudson.model.AllView.$$$reportNull$$$0(AllView.java)
      	at hudson.model.AllView.migrateLegacyPrimaryAllViewLocalizedName(AllView.java)
      	at hudson.model.MyViewsProperty.readResolve(MyViewsProperty.java:91)
      	at hudson.model.MyViewsProperty.<init>(MyViewsProperty.java:79)
      	at hudson.model.MyViewsProperty.<init>(MyViewsProperty.java:63)
      	at hudson.model.MyViewsProperty$DescriptorImpl.newInstance(MyViewsProperty.java:211)
      	at hudson.model.User.load(User.java:209)
      	at hudson.model.User.<init>(User.java:161)
      	at hudson.model.User.getOrCreate(User.java:519)
      	at hudson.model.User.getById(User.java:624)
      	at hudson.security.HudsonPrivateSecurityRealm.createAccount(HudsonPrivateSecurityRealm.java:403)
      	at jenkins.install.SetupWizard.init(SetupWizard.java:112)
      	at jenkins.install.SetupWizardTest.initSetupWizard(SetupWizardTest.java:74)
      	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:497)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:542)
      	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
      	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.lang.Thread.run(Thread.java:745)
      

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/MyViewsProperty.java
          core/src/main/java/hudson/model/ViewGroupMixIn.java
          test/src/test/java/hudson/model/MyViewsPropertyTest.java
          http://jenkins-ci.org/commit/jenkins/211b57e8b002b4da92743dfac3a1b902835e7652
          Log:
          JENKINS-48157 - Risk of NPE when migrating MyViewProperty without PrimaryView (#3156)

          • JENKINS-48157 - Annotate and document nullness conditions in MyViewsProperty and ViewGroupMixIn
          • [FIXED JENKINS-48157] - Prevent NPEs when using public API and when using null primaryViewName
          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/MyViewsProperty.java core/src/main/java/hudson/model/ViewGroupMixIn.java test/src/test/java/hudson/model/MyViewsPropertyTest.java http://jenkins-ci.org/commit/jenkins/211b57e8b002b4da92743dfac3a1b902835e7652 Log: JENKINS-48157 - Risk of NPE when migrating MyViewProperty without PrimaryView (#3156) JENKINS-48157 - Reproduce the issue in test JENKINS-48157 - Annotate and document nullness conditions in MyViewsProperty and ViewGroupMixIn [FIXED JENKINS-48157] - Prevent NPEs when using public API and when using null primaryViewName JENKINS-48157 - Fix typo in Javadoc
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          The fix has been integrated towards 2.92

          Show
          oleg_nenashev Oleg Nenashev added a comment - The fix has been integrated towards 2.92
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/MyViewsProperty.java
          core/src/main/java/hudson/model/ViewGroupMixIn.java
          test/src/test/java/hudson/model/MyViewsPropertyTest.java
          http://jenkins-ci.org/commit/jenkins/6be05b801454820caf3c6159185669f4392f25de
          Log:
          JENKINS-48157 - Risk of NPE when migrating MyViewProperty without PrimaryView (#3156)

          • JENKINS-48157 - Annotate and document nullness conditions in MyViewsProperty and ViewGroupMixIn
          • [FIXED JENKINS-48157] - Prevent NPEs when using public API and when using null primaryViewName

          (cherry picked from commit 211b57e8b002b4da92743dfac3a1b902835e7652)

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/MyViewsProperty.java core/src/main/java/hudson/model/ViewGroupMixIn.java test/src/test/java/hudson/model/MyViewsPropertyTest.java http://jenkins-ci.org/commit/jenkins/6be05b801454820caf3c6159185669f4392f25de Log: JENKINS-48157 - Risk of NPE when migrating MyViewProperty without PrimaryView (#3156) JENKINS-48157 - Reproduce the issue in test JENKINS-48157 - Annotate and document nullness conditions in MyViewsProperty and ViewGroupMixIn [FIXED JENKINS-48157] - Prevent NPEs when using public API and when using null primaryViewName JENKINS-48157 - Fix typo in Javadoc (cherry picked from commit 211b57e8b002b4da92743dfac3a1b902835e7652)

            People

            • Assignee:
              oleg_nenashev Oleg Nenashev
              Reporter:
              oleg_nenashev Oleg Nenashev
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: