Changeset 13975 for trunk


Ignore:
Timestamp:
2007-03-14T11:12:10+13:00 (17 years ago)
Author:
kjdon
Message:

check for null maxdocs param before converting to int

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractGS2FieldSearch.java

    r13916 r13975  
    478478        break;
    479479    }
    480 
    481480   
    482481    // run the query
     
    489488    Element metadata_list = this.doc.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
    490489    result.appendChild(metadata_list);
    491    
     490
    492491    // Add a metadata element specifying the number of matching documents
    493492    long totalDocs = numDocsMatched(query_result);
     
    502501    int docs_returned = docs.length;
    503502    if (does_paging) {
    504         int maxdocs = Integer.parseInt((String)params.get(MAXDOCS_PARAM));
    505         docs_returned = (maxdocs < (int)totalDocs ? maxdocs : (int)totalDocs);
     503        String maxdocs_str = (String)params.get(MAXDOCS_PARAM);
     504        if (maxdocs_str != null) {
     505        int maxdocs = Integer.parseInt(maxdocs_str);
     506        docs_returned = (maxdocs < (int)totalDocs ? maxdocs : (int)totalDocs);
     507        }
    506508    }
    507509    GSXML.addMetadata(this.doc, metadata_list, "numDocsReturned", ""+docs_returned);
     510
    508511    // add a metadata item to specify what actual query was done - eg if stuff was stripped out etc. and then we can use the query later, cos we don't know which parameter was the query
    509512    GSXML.addMetadata(this.doc, metadata_list, "query", query);
     
    517520        }
    518521    }
     522
    519523    // Create a term list to store the term information, and add it
    520524    Element term_list = this.doc.createElement(GSXML.TERM_ELEM+GSXML.LIST_MODIFIER);
Note: See TracChangeset for help on using the changeset viewer.