Changeset 13570


Ignore:
Timestamp:
2007-01-11T14:40:49+13:00 (17 years ago)
Author:
kjdon
Message:

catch unforseen exceptions, and check for null sort_field and start_results<1

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/java/org/nzdl/gsdl/LuceneWrap/GS2LuceneQuery.java

    r13557 r13570  
    157157        }
    158158        }
    159 
     159       
    160160        // do the query
    161161        // Simple case for getting all the matching documents
     
    202202        exception.printStackTrace();
    203203    }
    204 
     204    catch (Exception exception) {
     205        lucene_query_result.setError(LuceneQueryResult.OTHER_ERROR);
     206        exception.printStackTrace();
     207    }
    205208    return lucene_query_result;
    206209    }
     
    253256    public void setSortField(String sort_field) {
    254257    this.sort_field = sort_field;
    255     this.sorter = new Sort(sort_field);
     258    if (sort_field == null) {
     259        this.sorter = new Sort();
     260    } else {
     261        this.sorter = new Sort(sort_field);
     262    }
    256263    }
    257264    public String getSortField() {
     
    260267       
    261268    public void setStartResults(int start_results) {
     269    if (start_results < 1) {
     270        start_results = 1;
     271    }
    262272    this.start_results = start_results;
    263273    }
  • trunk/indexers/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java

    r13557 r13570  
    157157        }
    158158        }
    159 
     159       
    160160        // do the query
    161161        // Simple case for getting all the matching documents
     
    202202        exception.printStackTrace();
    203203    }
    204 
     204    catch (Exception exception) {
     205        lucene_query_result.setError(LuceneQueryResult.OTHER_ERROR);
     206        exception.printStackTrace();
     207    }
    205208    return lucene_query_result;
    206209    }
     
    253256    public void setSortField(String sort_field) {
    254257    this.sort_field = sort_field;
    255     this.sorter = new Sort(sort_field);
     258    if (sort_field == null) {
     259        this.sorter = new Sort();
     260    } else {
     261        this.sorter = new Sort(sort_field);
     262    }
    256263    }
    257264    public String getSortField() {
     
    260267       
    261268    public void setStartResults(int start_results) {
     269    if (start_results < 1) {
     270        start_results = 1;
     271    }
    262272    this.start_results = start_results;
    263273    }
Note: See TracChangeset for help on using the changeset viewer.