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

Introduce the validated version of Jenkins:getInstance()

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core

      Currently, the jenkins.model.Jenkins::getInstance() method is marked as @CheckForNull, but the most of Jenkins code does not actually check the return value. It leads to tons of static analysis errors, hence it is hard to analyze the code.

      I propose to...

      1. Add an additional method (e.g. Jenkins::getActiveInstance()), which throws an exception on access errors
      2. Convert all non-checked Jenkins::getInstance() methods

          [JENKINS-23339] Introduce the validated version of Jenkins:getInstance()

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/Hudson.java
          core/src/main/java/jenkins/model/Jenkins.java
          http://jenkins-ci.org/commit/jenkins/e6c2e16f7a1e2487a1d201aa11ae0c44e75a6ad7
          Log:
          [FIXED JENKINS-23339] - Introduce the validated Jenkins::getActiveInstance() method

          jenkins.model.Jenkins::getInstance() method is marked as @CheckForNull, but the most of Jenkins code does not actually check the return value. It leads to tons of static analysis errors, hence it is hard to analyze the code.

          The change also adds annotations to old methods like Hudson::getInstance()

          Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/Hudson.java core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/e6c2e16f7a1e2487a1d201aa11ae0c44e75a6ad7 Log: [FIXED JENKINS-23339] - Introduce the validated Jenkins::getActiveInstance() method jenkins.model.Jenkins::getInstance() method is marked as @CheckForNull, but the most of Jenkins code does not actually check the return value. It leads to tons of static analysis errors, hence it is hard to analyze the code. The change also adds annotations to old methods like Hudson::getInstance() Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/model/Hudson.java
          core/src/main/java/jenkins/model/Jenkins.java
          http://jenkins-ci.org/commit/jenkins/bfa557b16af80f8451980452a3dff97643138614
          Log:
          Merge branch 'JENKINS-23339' of github.com:synopsys-arc-oss/jenkins

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/model/Hudson.java core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/bfa557b16af80f8451980452a3dff97643138614 Log: Merge branch ' JENKINS-23339 ' of github.com:synopsys-arc-oss/jenkins

          dogfood added a comment -

          Integrated in jenkins_main_trunk #3802
          [FIXED JENKINS-23339] - Introduce the validated Jenkins::getActiveInstance() method (Revision e6c2e16f7a1e2487a1d201aa11ae0c44e75a6ad7)

          Result = SUCCESS
          o.v.nenashev : e6c2e16f7a1e2487a1d201aa11ae0c44e75a6ad7
          Files :

          • core/src/main/java/jenkins/model/Jenkins.java
          • core/src/main/java/hudson/model/Hudson.java

          dogfood added a comment - Integrated in jenkins_main_trunk #3802 [FIXED JENKINS-23339] - Introduce the validated Jenkins::getActiveInstance() method (Revision e6c2e16f7a1e2487a1d201aa11ae0c44e75a6ad7) Result = SUCCESS o.v.nenashev : e6c2e16f7a1e2487a1d201aa11ae0c44e75a6ad7 Files : core/src/main/java/jenkins/model/Jenkins.java core/src/main/java/hudson/model/Hudson.java

            oleg_nenashev Oleg Nenashev
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: