throws OAIInternalServerError
throws OAIInternalServerError, BadArgumentException
    private Map doRecordHarvest(String from, String until, String set,        String metadataPrefix, int offset)        throws OAIInternalServerError    {        Context context = null;        String schemaURL = getCrosswalks().getSchemaURL(metadataPrefix);        Map results = new HashMap();        if (schemaURL == null)        {            return null;        }        // List to put results in        List records = new LinkedList();        try        {            context = new Context();            // Get the relevant HarvestedItemInfo objects to make headers            DSpaceObject scope = resolveSet(context, set);            List itemInfos = Harvest.harvest(context, scope, from, until,                offset, MAX_RECORDS, // Limit amount returned from one request                true, true, true);   // Need items, containers + withdrawals            // Build list of XML records from item info objects            Iterator i = itemInfos.iterator();            while (i.hasNext())            {                HarvestedItemInfo itemInfo = (HarvestedItemInfo) i.next();                try                {                    String recordXML = getRecordFactory().create(                        itemInfo, schemaURL, metadataPrefix);                    records.add(recordXML);                }                catch (CannotDisseminateFormatException cdfe)                {                    /*                     * FIXME: I've a feeling a "CannotDisseminateFormatException"                     * should be discarded here - it's OK if some                     * records in the requested date range don't have the                     * requested metadata format available.  I'll just log it for                     * now.                     */                     if (log.isDebugEnabled())                        log.debug(LogManager.getHeader(context,                            "oai_warning", "Couldn't disseminate " +                                metadataPrefix + " for " + itemInfo.handle));                }            }                                // Put results in form needed to return            results.put("records", records.iterator());            log.info(LogManager.getHeader(context,                "oai_harvest",                "results=" + records.size()));                            // If we have MAX_RECORDS records, we need to provide a resumption            // token            if (records.size() >= MAX_RECORDS)            {                String resumptionToken = makeResumptionToken(                    from, until, set, metadataPrefix, offset + MAX_RECORDS);                if (log.isDebugEnabled())                {                    log.debug(LogManager.getHeader(context,                        "made_resumption_token",                        "token=" + resumptionToken));                }                results.put("resumptionMap",                    getResumptionMap(resumptionToken));                //results.put("resumptionToken", resumptionToken);            }        }        catch (SQLException se)        {            // Log the error            log.warn(LogManager.getHeader(context,                "database_error",                ""), se);            throw new OAIInternalServerError(se.toString());        }        finally        {            if (context != null)            {                context.abort();            }        }        return results;    }