Skip to content

DSpace CRIS extension of DSpace issue #11289: ConverterService.toRest() return value not always checked for null (potential NPEs) #519

@saschaszott

Description

@saschaszott

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());

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions