Changeset 27817

Show
Ignore:
Timestamp:
11.07.2013 16:19:40 (6 years ago)
Author:
kjdon
Message:

testing for null to avoid exceptions

Files:
1 modified

Legend:

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

    r27800 r27817  
    115115            ArrayList<String> field_names = new ArrayList<String>(); 
    116116            //field_names.add(getTextString("param.sortBy.rank", lang)); 
    117             getSortData(fields, field_names, lang); 
    118  
    119             param = GSXML.createParameterDescription2(this.doc, name, getTextString("param." + name, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, fields.get(0), fields, field_names); 
     117            if (getSortData(fields, field_names, lang)) { 
     118 
     119              param = GSXML.createParameterDescription2(this.doc, name, getTextString("param." + name, lang), GSXML.PARAM_TYPE_ENUM_SINGLE, fields.get(0), fields, field_names); 
     120            } 
    120121        } 
    121122        if (param != null) 
     
    130131    } 
    131132 
    132   protected void getSortData(ArrayList<String> sort_ids, ArrayList<String> sort_names, String lang) { 
     133  protected boolean getSortData(ArrayList<String> sort_ids, ArrayList<String> sort_names, String lang) { 
    133134 
    134135        Element sort_list = (Element) GSXML.getChildByTagName(this.config_info, SORT_ELEM + GSXML.LIST_MODIFIER); 
     136    if (sort_list == null) return false; 
    135137    NodeList sorts = sort_list.getElementsByTagName(SORT_ELEM); 
    136138    int len = sorts.getLength(); 
     139    if (len == 0) return false; 
    137140    for (int i = 0; i < len; i++) 
    138141      { 
     
    152155         
    153156      } 
    154      
     157    return true; 
    155158  } 
    156159    protected void getSortByIndexData(ArrayList<String> index_ids, ArrayList<String> index_names, String lang)