Status: Closed (View Workflow)
Affects Version/s: 1.8.0
Environment:This bug affects any Curation Task that is run across the entire site (all objects) from Commandline or XMLUI.
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:
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:
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.