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

XMLUI & CLI always show a NullPointerException after running a Site-wide Curation Task



    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.0
    • Fix Version/s: 1.8.1, 3.0
    • Component/s: DSpace API, XMLUI
    • Labels:
    • Environment:
      This bug affects any Curation Task that is run across the entire site (all objects) from Commandline or XMLUI.
    • Attachments:
    • Comments:
    • Documentation Status:
      Not Required


      There is a bug in the 1.8.0 Curation System such that Site-Wide Curation Tasks run from the XMLUI will always result in the following error:

      at org.dspace.storage.rdbms.DatabaseManager.queryTable(DatabaseManager.java:220)
      at org.dspace.eperson.Group.allMemberGroupIDs(Group.java:426)
      at org.dspace.eperson.Group.allMemberGroups(Group.java:396)
      at org.dspace.app.xmlui.aspect.administrative.Navigation.getValidity(Navigation.java:149)

      This error will be displayed whether the Curation Task succeeds or fails (you can check your DSpace Log file to see whether the Curation Task actually succeeded or failed).

      The error is caused by the Curator.doSite() method which always calls "context.complete()". When this is run via the XMLUI, that "complete()" call will close the existing XMLUI Context – meaning that any other code that attempts to use that Context object will encounter a NullPointerException as the Context object no longer has an open DB connection.

      What is going on behind the scenes seems to be the following:

      1. You kick off a Site-Wide curation task from XMLUI (it will use the current XMLUI Context object)
      2. Behind the scenes, the task may actually complete successfully (check the logs). But after the task completes, Curator.doSite() will call context.complete() on the current XMLUI context.
      3. At that point, the XMLUI will attempt to refresh the current page (in order to show the "Success" message). During this process, 'Navigation.getValidity()' gets called.
      4. The 'Navigation.getValidity()' method will attempt to use the XMLUI Context object to load all member groups of the current user.
      5. The result is a NullPointerException as the XMLUI Context object is no longer valid & its database connection was closed (because of #2 above).

      The above error is for Curation Tasks when they are run site-wide (across all objects), and only when run via the XMLUI.

      There is a similar NullPointerException for site-wide Curation Tasks when run from the Command-Line:

      Exception: null
      at org.dspace.core.Context.commit(Context.java:340)
      at org.dspace.core.Context.complete(Context.java:300)
      at org.dspace.curate.CurationCli.main(CurationCli.java:287)

      Both errors have the same root cause.

      A patch is attached which resolves the issues of closing the Context, and ensures that Curator.curationContext() caches any context it may create (so that it can be closed/committed automatically by Curator once the task completes). This patch is still undergoing testing, but it seems to be working well so far.




            tdonohue Tim Donohue
            tdonohue Tim Donohue
            0 Vote for this issue
            0 Start watching this issue