Merge pull request #2545 from atmire/DS-4359_issue-entity-type-null

[DS-4359] added nullcheck in EntityServiceImpl#getAllRelationshipTypes
This commit is contained in:
benbosman
2019-10-10 17:13:15 +02:00
committed by GitHub

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