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

            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 ]
            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
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue is related to JENKINS-23281 [ JENKINS-23281 ]
            oleg_nenashev Oleg Nenashev made changes -
            Summary Deprecate User.getUser() Deprecate User.getUser(String)
            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/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
            oleg_nenashev Oleg Nenashev made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue is related to JENKINS-43936 [ JENKINS-43936 ]
            jamesdumay James Dumay made changes -
            Remote Link This issue links to "CloudBees Internal OSS-2228 (Web Link)" [ 18385 ]
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue is related to JENKINS-48707 [ JENKINS-48707 ]

              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: