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

Undocumented behavior of Node#createComputer(), NPE risk

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      It is a follow-up to https://github.com/jenkinsci/jenkins/pull/2836#discussion_r110604865 It is unclear whether the method is nullable or not, and it seems there is a NPE risk in the core.

        Attachments

          Activity

          oleg_nenashev Oleg Nenashev created issue -
          oleg_nenashev Oleg Nenashev made changes -
          Field Original Value New Value
          Assignee Oleg Nenashev [ oleg_nenashev ]
          oleg_nenashev Oleg Nenashev made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          oleg_nenashev Oleg Nenashev made changes -
          Status In Progress [ 3 ] In Review [ 10005 ]
          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/AbstractCIBase.java
          core/src/main/java/hudson/model/Node.java
          core/src/main/java/hudson/slaves/RetentionStrategy.java
          core/src/main/java/jenkins/model/Jenkins.java
          http://jenkins-ci.org/commit/jenkins/bcf55ecd7f8a22046c5cb3c4c50016d936e5460c
          Log:
          JENKINS-43496 - Add handling of the null Node#createComputer() result. (#2922)

          • JENKINS-43496 - Add handling of the null Node#createComputer() result.

          it is a follow-up to https://github.com/jenkinsci/jenkins/pull/2836#discussion_r110604865

          De-facto many Cloud plugins return `null` in `Node#createLauncher()`, but it has never been documented.
          In order to prevent possible API misusages in the future, I have added annotations and fixed handling of the extension point in `AbstractCIBase#updateComputer()` which may fail in the case of `null` or `RuntimeException` in the Node implementation.

          • JENKINS-43496 - Use ProtectedExternally to protect Node#createComputer()
          • JENKINS-43496 - Remove the erroneous Nonnull annotation after the feedback from @jglick
          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/AbstractCIBase.java core/src/main/java/hudson/model/Node.java core/src/main/java/hudson/slaves/RetentionStrategy.java core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/bcf55ecd7f8a22046c5cb3c4c50016d936e5460c Log: JENKINS-43496 - Add handling of the null Node#createComputer() result. (#2922) JENKINS-43496 - Add handling of the null Node#createComputer() result. it is a follow-up to https://github.com/jenkinsci/jenkins/pull/2836#discussion_r110604865 De-facto many Cloud plugins return `null` in `Node#createLauncher()`, but it has never been documented. In order to prevent possible API misusages in the future, I have added annotations and fixed handling of the extension point in `AbstractCIBase#updateComputer()` which may fail in the case of `null` or `RuntimeException` in the Node implementation. JENKINS-43496 - Use ProtectedExternally to protect Node#createComputer() JENKINS-43496 - Remove the erroneous Nonnull annotation after the feedback from @jglick JENKINS-43496 - Fix typos noticed by @daniel-beck
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          The fix has been integrated towards 2.68

          Show
          oleg_nenashev Oleg Nenashev added a comment - The fix has been integrated towards 2.68
          oleg_nenashev Oleg Nenashev made changes -
          Status In Review [ 10005 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          oleg_nenashev Oleg Nenashev made changes -
          Labels lts-candidate
          olivergondza Oliver Gond┼ża made changes -
          Labels lts-candidate 2.60.3-fixed
          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/AbstractCIBase.java
          core/src/main/java/hudson/model/Node.java
          core/src/main/java/hudson/slaves/RetentionStrategy.java
          core/src/main/java/jenkins/model/Jenkins.java
          http://jenkins-ci.org/commit/jenkins/8cd6fd81a5fd9960a05bd485afec9c3976324cb5
          Log:
          JENKINS-43496 - Add handling of the null Node#createComputer() result. (#2922)

          • JENKINS-43496 - Add handling of the null Node#createComputer() result.

          it is a follow-up to https://github.com/jenkinsci/jenkins/pull/2836#discussion_r110604865

          De-facto many Cloud plugins return `null` in `Node#createLauncher()`, but it has never been documented.
          In order to prevent possible API misusages in the future, I have added annotations and fixed handling of the extension point in `AbstractCIBase#updateComputer()` which may fail in the case of `null` or `RuntimeException` in the Node implementation.

          • JENKINS-43496 - Use ProtectedExternally to protect Node#createComputer()
          • JENKINS-43496 - Remove the erroneous Nonnull annotation after the feedback from @jglick

          (cherry picked from commit bcf55ecd7f8a22046c5cb3c4c50016d936e5460c)

          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/AbstractCIBase.java core/src/main/java/hudson/model/Node.java core/src/main/java/hudson/slaves/RetentionStrategy.java core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/8cd6fd81a5fd9960a05bd485afec9c3976324cb5 Log: JENKINS-43496 - Add handling of the null Node#createComputer() result. (#2922) JENKINS-43496 - Add handling of the null Node#createComputer() result. it is a follow-up to https://github.com/jenkinsci/jenkins/pull/2836#discussion_r110604865 De-facto many Cloud plugins return `null` in `Node#createLauncher()`, but it has never been documented. In order to prevent possible API misusages in the future, I have added annotations and fixed handling of the extension point in `AbstractCIBase#updateComputer()` which may fail in the case of `null` or `RuntimeException` in the Node implementation. JENKINS-43496 - Use ProtectedExternally to protect Node#createComputer() JENKINS-43496 - Remove the erroneous Nonnull annotation after the feedback from @jglick JENKINS-43496 - Fix typos noticed by @daniel-beck (cherry picked from commit bcf55ecd7f8a22046c5cb3c4c50016d936e5460c)

            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: