• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None

      User#getUser() method causes lots of confusion for plugin developers. It implicitly creates a user if it cannot be found, and in many cases this is actually a not-expected behavior

      I propose to deprecate the method and to create a new User#getOrCreate() which would be more explicit

          [JENKINS-47718] Deprecate User.getUser(String)

          Oleg Nenashev added a comment -

          The API misusage also causes JENKINS-23281 in some cases

          Oleg Nenashev added a comment - The API misusage also causes JENKINS-23281 in some cases

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/Cause.java
          core/src/main/java/hudson/model/Run.java
          core/src/main/java/hudson/model/User.java
          core/src/main/java/jenkins/scm/RunWithSCM.java
          http://jenkins-ci.org/commit/jenkins/8cb3351319358c056556bd568f0e883d982f6d22
          Log:
          JENKINS-47718 - Deprecate User#getUser(String) (#3114)

          `User#getUser(String)` method causes lots of confusion for plugin developers. It implicitly creates a user if it cannot be found, and in many cases this is actually a not-expected behavior. This change deprecates the method and to creates a new `User#getOrCreate()` which is more explicit

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/Cause.java core/src/main/java/hudson/model/Run.java core/src/main/java/hudson/model/User.java core/src/main/java/jenkins/scm/RunWithSCM.java http://jenkins-ci.org/commit/jenkins/8cb3351319358c056556bd568f0e883d982f6d22 Log: JENKINS-47718 - Deprecate User#getUser(String) (#3114) JENKINS-47718 - Deprecate User#getUser(String) `User#getUser(String)` method causes lots of confusion for plugin developers. It implicitly creates a user if it cannot be found, and in many cases this is actually a not-expected behavior. This change deprecates the method and to creates a new `User#getOrCreate()` which is more explicit JENKINS-47718 - Address comments from @jglick

          Oleg Nenashev added a comment -

          This change has been integrated towards 2.91

          Oleg Nenashev added a comment - This change has been integrated towards 2.91

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

              Created:
              Updated:
              Resolved: