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

NPE during loading of branch jobs when migrating from 1.x to 2.x

    XMLWordPrintable

Details

    Description

      There is an NPE in the readResolve() that gets squashed by the RobustReflectionConverter leading to a partially valid object.

      This partially valid object can then have unintended consequences. Better is to make the getter methods defensive about the potential null rather than relying on readResolve() to fix.

      Here is one piece of sample data that generates the NPE

          <org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty plugin="workflow-multibranch@2.10-SNAPSHOT">
            <branch class="jenkins.branch.Branch$Dead" plugin="branch-api@1.12-SNAPSHOT">
              <sourceId>::NullSCMSource::</sourceId>
              <head class="org.jenkinsci.plugins.github_branch_source.BranchSCMHead" plugin="github-branch-source@1.11-SNAPSHOT">
                <name>quicker</name>
              </head>
              <scm class="hudson.scm.NullSCM"/>
              <properties class="java.util.concurrent.CopyOnWriteArrayList">
                <jenkins.branch.NoTriggerBranchProperty/>
              </properties>
            </branch>
          </org.jenkinsci.plugins.workflow.multibranch.BranchJobProperty>
      

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: Stephen Connolly
            Path:
            src/test/java/jenkins/branch/BranchTest.java
            http://jenkins-ci.org/commit/branch-api-plugin/d13aebad21abcbf1d5defa4845999de92e182d63
            Log:
            JENKINS-41209 Add the test case

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/test/java/jenkins/branch/BranchTest.java http://jenkins-ci.org/commit/branch-api-plugin/d13aebad21abcbf1d5defa4845999de92e182d63 Log: JENKINS-41209 Add the test case

            Code changed in jenkins
            User: Stephen Connolly
            Path:
            src/main/java/jenkins/branch/Branch.java
            http://jenkins-ci.org/commit/branch-api-plugin/c1fc325e794935defea0a552007099abde79d65f
            Log:
            [FIXED JENKINS-41209] Be more defensive of nulls in accessing the action field

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/branch/Branch.java http://jenkins-ci.org/commit/branch-api-plugin/c1fc325e794935defea0a552007099abde79d65f Log: [FIXED JENKINS-41209] Be more defensive of nulls in accessing the action field

            Code changed in jenkins
            User: Stephen Connolly
            Path:
            src/main/java/jenkins/branch/Branch.java
            src/test/java/jenkins/branch/BranchTest.java
            http://jenkins-ci.org/commit/branch-api-plugin/a2c58a7949c2fe301f43ba8d7276207ef0e3e526
            Log:
            Merge pull request #73 from stephenc/jenkins-41209

            JENKINS-41209 Null Pointer Exception when deserializing during upgrade

            Compare: https://github.com/jenkinsci/branch-api-plugin/compare/c66989984070...a2c58a7949c2

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/branch/Branch.java src/test/java/jenkins/branch/BranchTest.java http://jenkins-ci.org/commit/branch-api-plugin/a2c58a7949c2fe301f43ba8d7276207ef0e3e526 Log: Merge pull request #73 from stephenc/jenkins-41209 JENKINS-41209 Null Pointer Exception when deserializing during upgrade Compare: https://github.com/jenkinsci/branch-api-plugin/compare/c66989984070...a2c58a7949c2

            scm-api-2.0.2
            git-2.6.4 or git-3.0.4
            branch-api-2.0.2
            bitbucket-branch-source-2.0.2
            github-branch-source-2.0.1
            cloudbees-folder-5.17
            workflow-multibranch-2.11

            stephenconnolly Stephen Connolly added a comment - scm-api-2.0.2 git-2.6.4 or git-3.0.4 branch-api-2.0.2 bitbucket-branch-source-2.0.2 github-branch-source-2.0.1 cloudbees-folder-5.17 workflow-multibranch-2.11

            People

              stephenconnolly Stephen Connolly
              stephenconnolly Stephen Connolly
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: