mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Do not reuse global Context for cleanup actions...it may already be closed
This commit is contained in:
@@ -37,12 +37,15 @@ public class RelationshipTypeBuilder extends AbstractBuilder<RelationshipType, R
|
||||
|
||||
@Override
|
||||
public void cleanup() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
List<Relationship> byRelationshipType = relationshipService.findByRelationshipType(context, relationshipType);
|
||||
for (Relationship relationship : byRelationshipType) {
|
||||
relationshipService.delete(context, relationship);
|
||||
try (Context c = new Context()) {
|
||||
c.turnOffAuthorisationSystem();
|
||||
List<Relationship> byRelationshipType = relationshipService
|
||||
.findByRelationshipType(c, relationshipType);
|
||||
for (Relationship relationship : byRelationshipType) {
|
||||
relationshipService.delete(c, relationship);
|
||||
}
|
||||
c.complete();
|
||||
}
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
delete(relationshipType);
|
||||
}
|
||||
|
Reference in New Issue
Block a user