Describe the bug
In this issue only DSpace CRIS specific Java classes that invoke the toRest method of ConverterService are listed. The return value of this method can be null. Therefore, any calling code should / must check that the result is not null before further processing.
At some locations in the DSpace and DSpace CRIS backend codebase this check is missing, which creates the risk of a NullPointerException (NPE). Issue DSpace#11289 contains all locations in the DSpace codebase.
In fact, I have already observed a concrete NPE in conjunction with a toRest method invocation in DSpace CRIS method org.dspace.app.rest.repository.IdentifierRestRepository.getDSObyIdentifier (not sure how to reproduce it).
To improve the robustness of the DSpace and DSpace CRIS backend, additional null checks should be added at all affected call sites of toRest.
Call sites without a null check in the DSpace CRIS codebase are:
|
eir = converter.toRest(source, utils.obtainProjection()); |
|
DSpaceObjectRest dsor = converter.toRest(dso, utils.obtainProjection()); |