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

Context.java turnOffAuthorisationSystem() can throw a NPE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.2
    • Fix Version/s: 1.6.0
    • Component/s: DSpace API
    • Labels:
      None
    • Attachments:
      1
    • Comments:
      0

      Description

      In Context.java, when the methods turnOffAuthorisationSystem() or restoreAuthSystemState() are called, the calling class name is recorded. However the calling class is hardcoded to be the 4th item in stack. The calling class will not always be in the 4th position in the stack.

      For example when using this method in a CLI application, it could be the 2nd item in the stack, the first being java.Thread.

      Patch attached which replaces the hardcoded:

      String caller = stackTrace[3].getClassName();

      with

      String caller = stackTrace[stackTrace.length - 1].getClassName();

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stuartlewis Stuart Lewis
                Reporter:
                stuartlewis Stuart Lewis
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: