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

Deprecate User.getUser(String)

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      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

        Attachments

          Issue Links

            Activity

            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            The API misusage also causes JENKINS-23281 in some cases

            Show
            oleg_nenashev Oleg Nenashev added a comment - The API misusage also causes JENKINS-23281 in some cases
            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/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

            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/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
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            This change has been integrated towards 2.91

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

              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: