Skip to content

Commit

Permalink
There were failing tests due to NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarko committed Nov 14, 2024
1 parent ce6b8ca commit f350153
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
package org.dspace.app.rest.converter;

import java.util.Objects;

import org.dspace.app.rest.model.HandleRest;
import org.dspace.app.rest.projection.Projection;
import org.dspace.handle.Handle;
Expand Down Expand Up @@ -35,7 +37,11 @@ public HandleRest convert(Handle modelObject, Projection projection) {
handleRest.setHandle(modelObject.getHandle());
handleRest.setResourceTypeID(modelObject.getResourceTypeId());
handleRest.setUrl(modelObject.getUrl());
handleRest.setResourceId(modelObject.getDSpaceObject().getID());
if (Objects.nonNull(modelObject.getDSpaceObject())) {
handleRest.setResourceId(modelObject.getDSpaceObject().getID());
} else {
handleRest.setResourceId(null);
}
return handleRest;
}

Expand Down

0 comments on commit f350153

Please sign in to comment.