Program: 166416
Project: 166416
Buggy source:
public SearchFilter extractCommonCriteriasForFilter(HttpServletRequest request,SearchFilter ret,List<SortField> sortFields){
  int startIndex=restErrorUtil.parseInt(request.getParameter(SearchFilter.START_INDEX),0,"String_Node_Str",MessageEnums.INVALID_INPUT_DATA,null,SearchFilter.START_INDEX);
  ret.setStartIndex(startIndex);
  int pageSize=restErrorUtil.parseInt(request.getParameter(SearchFilter.PAGE_SIZE),configUtil.getDefaultMaxRows(),"String_Node_Str",MessageEnums.INVALID_INPUT_DATA,null,SearchFilter.PAGE_SIZE);
  ret.setMaxRows(pageSize);
  ret.setGetCount(restErrorUtil.parseBoolean(request.getParameter("String_Node_Str"),true));
  String sortBy=restErrorUtil.validateString(request.getParameter(SearchFilter.SORT_BY),StringUtil.VALIDATION_ALPHA,"String_Node_Str",MessageEnums.INVALID_INPUT_DATA,null,SearchFilter.SORT_BY);
  boolean sortSet=false;
  if (!StringUtils.isEmpty(sortBy)) {
    for (    SortField sortField : sortFields) {
      if (sortField.getParamName().equalsIgnoreCase(sortBy)) {
        ret.setSortBy(sortField.getParamName());
        String sortType=restErrorUtil.validateString(request.getParameter("String_Node_Str"),StringUtil.VALIDATION_ALPHA,"String_Node_Str",MessageEnums.INVALID_INPUT_DATA,null,"String_Node_Str");
        ret.setSortType(sortType);
        sortSet=true;
        break;
      }
    }
  }
  if (!sortSet && !StringUtils.isEmpty(sortBy)) {
    logger.info("String_Node_Str" + sortBy,new Throwable());
  }
  if (ret.getParams() == null) {
    ret.setParams(new HashMap<String,String>());
  }
  return ret;
}

Fixed version (ground truth):
public SearchFilter extractCommonCriteriasForFilter(HttpServletRequest request,SearchFilter ret,List<SortField> sortFields){
  int startIndex=restErrorUtil.parseInt(request.getParameter(SearchFilter.START_INDEX),0,"String_Node_Str",MessageEnums.INVALID_INPUT_DATA,null,SearchFilter.START_INDEX);
  startIndex=startIndex < 0 ? 0 : startIndex;
  ret.setStartIndex(startIndex);
  int pageSize=restErrorUtil.parseInt(request.getParameter(SearchFilter.PAGE_SIZE),configUtil.getDefaultMaxRows(),"String_Node_Str",MessageEnums.INVALID_INPUT_DATA,null,SearchFilter.PAGE_SIZE);
  ret.setMaxRows(pageSize);
  ret.setGetCount(restErrorUtil.parseBoolean(request.getParameter("String_Node_Str"),true));
  String sortBy=restErrorUtil.validateString(request.getParameter(SearchFilter.SORT_BY),StringUtil.VALIDATION_ALPHA,"String_Node_Str",MessageEnums.INVALID_INPUT_DATA,null,SearchFilter.SORT_BY);
  boolean sortSet=false;
  if (!StringUtils.isEmpty(sortBy)) {
    for (    SortField sortField : sortFields) {
      if (sortField.getParamName().equalsIgnoreCase(sortBy)) {
        ret.setSortBy(sortField.getParamName());
        String sortType=restErrorUtil.validateString(request.getParameter("String_Node_Str"),StringUtil.VALIDATION_ALPHA,"String_Node_Str",MessageEnums.INVALID_INPUT_DATA,null,"String_Node_Str");
        ret.setSortType(sortType);
        sortSet=true;
        break;
      }
    }
  }
  if (!sortSet && !StringUtils.isEmpty(sortBy)) {
    logger.info("String_Node_Str" + sortBy,new Throwable());
  }
  if (ret.getParams() == null) {
    ret.setParams(new HashMap<String,String>());
  }
  return ret;
}