Skip to content

Commit

Permalink
Fix OAI indexing error by adding in checks where Entity Type can be null
Browse files Browse the repository at this point in the history
  • Loading branch information
tdonohue committed Apr 11, 2024
1 parent 76d5378 commit 1b91ae1
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -103,7 +104,12 @@ public List<RelationshipType> getAllRelationshipTypes(Context context, Entity en
@Override
public List<RelationshipType> getAllRelationshipTypes(Context context, Entity entity, Integer limit, Integer offset)
throws SQLException {
return relationshipTypeService.findByEntityType(context, this.getType(context, entity), limit, offset);
EntityType entityType = this.getType(context, entity);
if (entityType != null) {
return relationshipTypeService.findByEntityType(context, entityType, limit, offset);
} else {
return Collections.emptyList();
}
}

@Override
Expand All @@ -115,7 +121,12 @@ public List<RelationshipType> getLeftRelationshipTypes(Context context, Entity e
@Override
public List<RelationshipType> getLeftRelationshipTypes(Context context, Entity entity, boolean isLeft,
Integer limit, Integer offset) throws SQLException {
return relationshipTypeService.findByEntityType(context, this.getType(context, entity), isLeft, limit, offset);
EntityType entityType = this.getType(context, entity);
if (entityType != null) {
return relationshipTypeService.findByEntityType(context, entityType, isLeft, limit, offset);
} else {
return Collections.emptyList();
}
}

@Override
Expand All @@ -128,7 +139,12 @@ public List<RelationshipType> getRightRelationshipTypes(Context context, Entity
public List<RelationshipType> getRightRelationshipTypes(Context context, Entity entity, boolean isLeft,
Integer limit, Integer offset) throws SQLException {

return relationshipTypeService.findByEntityType(context, this.getType(context, entity), isLeft, limit, offset);
EntityType entityType = this.getType(context, entity);
if (entityType != null) {
return relationshipTypeService.findByEntityType(context, entityType, isLeft, limit, offset);
} else {
return Collections.emptyList();
}
}

@Override
Expand Down

0 comments on commit 1b91ae1

Please sign in to comment.