Changeset 15041


Ignore:
Timestamp:
2008-03-05T11:56:35+13:00 (14 years ago)
Author:
ak19
Message:

Attempted fix for http://trac.greenstone.org/ticket/245 - Java crash, index out of bounds

File:
1 edited

Legend:

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

    r14943 r15041  
    360360        getIndexData(fields, field_names, lang);
    361361        // the field list -  read from config file
    362         param = GSXML.createParameterDescription2(this.doc, name, getTextString("param."+name, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, (String)fields.get(0), fields, field_names );
     362       
     363        // Fix for http://trac.greenstone.org/ticket/245 "java crash, index out of bounds"
     364        // org.greenstone.gsdl3.service.AbstractGS2FieldSearch.createParameter(AbstractGS2FieldSearch.java:362)
     365        // Changed from:
     366        // param = GSXML.createParameterDescription2(this.doc, name, getTextString("param."+name, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, (String)fields.get(0), fields, field_names );
     367        String default_value = (fields.size() > 0) ? (String)fields.get(0) : null;
     368              // don't want to access element 0 if fields.size()==0, and
     369              // GSXML.createParameterDescription2 checks for default_value==null condition
     370        param = GSXML.createParameterDescription2(this.doc, name, getTextString("param."+name, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, default_value, fields, field_names );
    363371       
    364372    } else if (name.equals(FIELD_COMBINE_PARAM)) {
Note: See TracChangeset for help on using the changeset viewer.