Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-2941

PasswordAuthentication getSpecialGroups empty exception catchblock

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0, 3.1, 3.2, 3.3, 3.4 , 3.5, 4.0, 4.1, 4.2, 4.3, 4.4, 5.0, 5.1, 5.2, 5.3, 5.4, 6.0
    • Fix Version/s: 6.0
    • Component/s: None
    • Attachments:
      0
    • Comments:
      8
    • Documentation Status:
      Needed

      Description

      When profiling to figure out DS-2939, I saw that each time a context is obtained, the AuthenticationManagers passes on a request for special groups to the PasswordAuthentication class.

      this getSpecialGroups method routinely relies on throwing & catching an exception each time an anonymous user requests a page in DSpace.
      https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/authenticate/PasswordAuthentication.java#L161

      this is because getCurrentUser returns null if the person is not logged in, so the .getPasswordHash() method gets executed on null, throwing the exception.

      The catch block doesn't do any useful handling, making this a very expensive way to treat "normal" behaviour.

      http://java-performance.info/throwing-an-exception-in-java-is-very-slow/
      http://stackoverflow.com/questions/299068/how-slow-are-java-exceptions

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kevin van de velde Kevin Van de Velde (Atmire)
                Reporter:
                bram Bram Luyten (Atmire)
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: