mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-10 11:33:11 +00:00
[DS-4359] added nullcheck in EntityServiceImpl#getAllRelationshipTypes
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
package org.dspace.content;
|
package org.dspace.content;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -94,6 +95,9 @@ public class EntityServiceImpl implements EntityService {
|
|||||||
@Override
|
@Override
|
||||||
public List<RelationshipType> getAllRelationshipTypes(Context context, Entity entity) throws SQLException {
|
public List<RelationshipType> getAllRelationshipTypes(Context context, Entity entity) throws SQLException {
|
||||||
EntityType entityType = this.getType(context, entity);
|
EntityType entityType = this.getType(context, entity);
|
||||||
|
if (entityType == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
List<RelationshipType> listToReturn = new LinkedList<>();
|
List<RelationshipType> listToReturn = new LinkedList<>();
|
||||||
for (RelationshipType relationshipType : relationshipTypeService.findAll(context)) {
|
for (RelationshipType relationshipType : relationshipTypeService.findAll(context)) {
|
||||||
if (relationshipType.getLeftType().getID() == entityType.getID() ||
|
if (relationshipType.getLeftType().getID() == entityType.getID() ||
|
||||||
|
Reference in New Issue
Block a user