Changeset 2688


Ignore:
Timestamp:
03/13/13 10:55:16 (11 years ago)
Author:
oschonef
Message:
  • fix "first record out of range" generated for empty result sets
Location:
SRUServer/trunk/src/main/java/eu/clarin/sru/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • SRUServer/trunk/src/main/java/eu/clarin/sru/server/SRURequestImpl.java

    r2681 r2688  
    6666    private CQLNode query;
    6767    private String rawQuery;
    68     private int startRecord = DEFAULT_START_RECORD;
     68    private int startRecord = -1;
    6969    private int maximumRecords = -1;
    7070    private String recordSchemaName;
     
    7676    private CQLNode scanClause;
    7777    private String rawScanClause;
    78     private int responsePosition = DEFAULT_RESPONSE_POSITION;
     78    private int responsePosition = -1;
    7979    private int maximumTerms = -1;
    8080
     
    411411
    412412
     413    int getRawStartRecord() {
     414        return startRecord;
     415    }
     416
     417
    413418    int getRawMaximumRecords() {
    414419        return maximumRecords;
     
    418423    String getRawScanClause() {
    419424        return rawScanClause;
     425    }
     426
     427
     428    int getRawResponsePosition() {
     429        return responsePosition;
    420430    }
    421431
     
    493503    @Override
    494504    public int getStartRecord() {
    495         return startRecord;
     505        return (startRecord > 0) ? startRecord : DEFAULT_START_RECORD;
    496506    }
    497507
     
    553563    @Override
    554564    public int getResponsePosition() {
    555         return responsePosition;
     565        return (responsePosition >= 0)
     566                ? responsePosition : DEFAULT_RESPONSE_POSITION;
    556567    }
    557568
  • SRUServer/trunk/src/main/java/eu/clarin/sru/server/SRUServer.java

    r2644 r2688  
    353353        // check, of startRecord position is greater than total record set
    354354        if ((result.getTotalRecordCount() >= 0) &&
    355             (request.getStartRecord() > 0) &&
    356             (request.getStartRecord() > result.getTotalRecordCount())) {
    357             throw new SRUException(SRUConstants.SRU_FIRST_RECORD_POSITION_OUT_OF_RANGE);
     355            (request.getRawStartRecord() > 0) &&
     356            (request.getRawStartRecord() > result.getTotalRecordCount())) {
     357            throw new SRUException(
     358                    SRUConstants.SRU_FIRST_RECORD_POSITION_OUT_OF_RANGE);
    358359        }
    359360
Note: See TracChangeset for help on using the changeset viewer.