mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +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
|
@Override
|
||||||
public void cleanup() throws Exception {
|
public void cleanup() throws Exception {
|
||||||
context.turnOffAuthorisationSystem();
|
try (Context c = new Context()) {
|
||||||
List<Relationship> byRelationshipType = relationshipService.findByRelationshipType(context, relationshipType);
|
c.turnOffAuthorisationSystem();
|
||||||
|
List<Relationship> byRelationshipType = relationshipService
|
||||||
|
.findByRelationshipType(c, relationshipType);
|
||||||
for (Relationship relationship : byRelationshipType) {
|
for (Relationship relationship : byRelationshipType) {
|
||||||
relationshipService.delete(context, relationship);
|
relationshipService.delete(c, relationship);
|
||||||
|
}
|
||||||
|
c.complete();
|
||||||
}
|
}
|
||||||
context.restoreAuthSystemState();
|
|
||||||
|
|
||||||
delete(relationshipType);
|
delete(relationshipType);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user