[DS-4359] added nullcheck in EntityServiceImpl#getAllRelationshipTypes

This commit is contained in:
Raf Ponsaerts
2019-10-10 14:08:30 +02:00
parent f65c8523a8
commit 15a4202472

View File

@@ -8,6 +8,7 @@
package org.dspace.content;
import java.sql.SQLException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
@@ -94,6 +95,9 @@ public class EntityServiceImpl implements EntityService {
@Override
public List<RelationshipType> getAllRelationshipTypes(Context context, Entity entity) throws SQLException {
EntityType entityType = this.getType(context, entity);
if (entityType == null) {
return Collections.emptyList();
}
List<RelationshipType> listToReturn = new LinkedList<>();
for (RelationshipType relationshipType : relationshipTypeService.findAll(context)) {
if (relationshipType.getLeftType().getID() == entityType.getID() ||