E-mails sent from DSpace are not presenting the correct URI.
Example e-mail content:
I have isolated the problem to (during WFSTATE_ARCHIVE):
The handleService.findHandle call does not return a handle (returns NULL) because the handle has not yet been committed to the database.
The handle can be retrieved by appending the following after that call:
But this is not ideal as it assumes the handle will be saved to the database.
It seems that in both cases the e-mail is sent before the submission is fully completed.
If the e-mail was sent after the submission was finished, then that extra line of code would be unneeded.
More specifically, if the submission fails at a later point an e-mail will have already been sent (giving the recipient of the e-mail the wrong impression that the submission is completed).
Sending the e-mail after this step would be ideal: https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace-api/src/main/java/org/dspace/submit/step/CompleteStep.java#L103
To observe this behavior:
1) add some logging before/after the relevant lines of code or enabling debugging in the logs.
2) add some sleep commands before/after the relevant lines of code.
2) create a new submission without finalizing.
3) review the logs to get the uuid of the in-progress submission.
4) add a watch every one second in the Postgresql for the handle table, selecting the uuid.
5) finalize the submission, and observe the state of the handle table and compare the timestamps between the logs and the Postgresql watch results.
I have consistently observed that the handle does not exist until the CompleteStep, which is long after the e-mail is sent. The e-mail is simply being sent too early in the process!