Fix NullPointerException. Only return userid if EPerson not null

(cherry picked from commit f34c592352)
This commit is contained in:
Tim Donohue
2024-05-07 17:17:00 -05:00
committed by github-actions[bot]
parent 606b10ccb7
commit 448a69483b

View File

@@ -14,7 +14,6 @@ import org.dspace.app.rest.model.ProcessRest;
import org.dspace.app.rest.projection.Projection;
import org.dspace.scripts.Process;
import org.dspace.scripts.service.ProcessService;
import org.hibernate.ObjectNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@@ -40,10 +39,8 @@ public class ProcessConverter implements DSpaceConverter<Process, ProcessRest> {
processRest.setId(process.getID());
processRest.setScriptName(process.getName());
processRest.setProcessId(process.getID());
try {
if (process.getEPerson() != null) {
processRest.setUserId(process.getEPerson().getID());
} catch (ObjectNotFoundException e ) {
processRest.setUserId(null);
}
processRest.setProcessStatus(process.getProcessStatus());
processRest.setStartTime(process.getStartTime());