diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererAbstract.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererAbstract.java index df528fb134e70cbc253e26b1706da610c1f3954a..e289c15a9f6b4fa16f7761dee2264696a9cb60b5 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererAbstract.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererAbstract.java @@ -42,13 +42,14 @@ public abstract class RecordListDelivererAbstract implements RecordListDeliverer // Check if resumptionToken is invalid or existing. if (request.getResumptionToken() != null) { - boolean restokDCExisting = RecordListDelivererIDIOM.cursorCollector != null + boolean restokIDIOMExisting = RecordListDelivererIDIOM.cursorCollector != null && RecordListDelivererIDIOM.cursorCollector.containsKey(request.getResumptionToken()); - System.out.println(request.getResumptionToken() + " exists: " + RecordListDelivererDC.cursorCollector.containsKey(request.getResumptionToken())); - boolean restokIDIOMExisting = RecordListDelivererDC.cursorCollector != null + + boolean restokDCExisting = RecordListDelivererDC.cursorCollector != null && RecordListDelivererDC.cursorCollector.containsKey(request.getResumptionToken()); - if (!restokDCExisting || !restokIDIOMExisting) { - System.out.println("BUHUH"); + + if (!restokDCExisting && !restokIDIOMExisting) { + System.out.println("BLA"); result.setError(TGConstants.OAI_BAD_RESUMPTION_TOKEN, "The value of the " + request.getResumptionToken() + " argument is invalid or expired."); } diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java index ef5ba91b6ee0f5dbbb321403340c611fa02ac8c1..e90e956aa5d43c884f793027f814f31127fda5f3 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java @@ -347,17 +347,19 @@ public class OaiPmhTest { System.out.println("Test for the verb \"ListRecords\" with sets with succesfull response"); //String p = this.request.getRequest("ListRecords", "", "oai_dc", "project:TGPR-f89ad029-4eb2-ae5c-6028-5db876513128", "", "", ""); - String p = this.request.getRequest("ListRecords", "", "oai_dc", "", "2012-04-23T20:04:18Z", "2012-04-23T20:04:18Z", ""); + String p = this.request.getRequest("ListRecords", "", "oai_dc", "", "", "", ""); System.out.println(p); String resToken = ""; - /*for (Map.Entry<String, Integer> entry : RecordListDelivererDC.cursorCollector.entrySet()) { + for (Map.Entry<String, Integer> entry : RecordListDelivererDC.cursorCollector.entrySet()) { resToken = entry.getKey(); + String p2 = this.request.getRequest("ListRecords", "", "", "", "", "", resToken); + System.out.println(p2); + System.out.println("HASH MAP AFTER: "); + System.out.println(RecordListDelivererDC.cursorCollector); + System.out.println("-----------------------------------\n"); } - String p2 = this.request.getRequest("ListRecords", "", "", "", "", "", resToken); - System.out.println(p2); - System.out.println("HASH MAP AFTER: "); - System.out.println(RecordListDelivererDC.cursorCollector); - System.out.println("-----------------------------------\n");*/ + + } /**