[DS-1848] OAI harvest issues when starting from control panel/command line

This commit is contained in:
KevinVdV
2014-01-30 10:47:37 +01:00
parent 3f5214e58b
commit 7f9bbad94a

View File

@@ -374,8 +374,12 @@ public class OAIHarvester {
listRecords = new ListRecords(oaiSource, resumptionToken); listRecords = new ListRecords(oaiSource, resumptionToken);
} }
ourContext.turnOffAuthorisationSystem(); ourContext.turnOffAuthorisationSystem();
targetCollection.update(); try {
ourContext.restoreAuthSystemState(); targetCollection.update();
} finally {
//In case of an exception, make sure to restore our authentication state to the previous state
ourContext.restoreAuthSystemState();
}
ourContext.commit(); ourContext.commit();
} }
} }
@@ -404,7 +408,6 @@ public class OAIHarvester {
targetCollection.update(); targetCollection.update();
ourContext.commit(); ourContext.commit();
ourContext.restoreAuthSystemState(); ourContext.restoreAuthSystemState();
ourContext.restoreAuthSystemState();
} }
// If we got to this point, it means the harvest was completely successful // If we got to this point, it means the harvest was completely successful