Program: 149219
Project: 149219
Buggy source:
public ListRange getUpdateReportList(int start,int limit,String sort,String dir,String regex) throws Exception {
  ListRange listRange=new ListRange();
  WSDataClusterPK wsDataClusterPK=new WSDataClusterPK(XSystemObjects.DC_UPDATE_PREPORT.getName());
  String conceptName="String_Node_Str";
  ArrayList<WSWhereItem> conditions=new ArrayList<WSWhereItem>();
  if (regex != null && regex.length() > 0) {
    JSONObject criteria=new JSONObject(regex);
    if (!criteria.isNull("String_Node_Str")) {
      String concept=(String)criteria.get("String_Node_Str");
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.CONTAINS,concept.trim(),WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String key=(String)criteria.get("String_Node_Str");
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.CONTAINS,key.trim(),WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String source=(String)criteria.get("String_Node_Str");
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.EQUALS,source.trim(),WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String operationType=(String)criteria.get("String_Node_Str");
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.EQUALS,operationType.trim(),WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String startDate=(String)criteria.get("String_Node_Str");
      SimpleDateFormat dataFmt=new SimpleDateFormat("String_Node_Str");
      Date date=dataFmt.parse(startDate);
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.GREATER_THAN_OR_EQUAL,date.getTime() + "String_Node_Str",WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String endDate=(String)criteria.get("String_Node_Str");
      SimpleDateFormat dataFmt=new SimpleDateFormat("String_Node_Str");
      Date date=dataFmt.parse(endDate);
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.LOWER_THAN_OR_EQUAL,date.getTime() + "String_Node_Str",WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
  }
  WSWhereItem wi=null;
  if (conditions.size() == 0)   wi=null;
 else {
    WSWhereAnd and=new WSWhereAnd(conditions.toArray(new WSWhereItem[conditions.size()]));
    wi=new WSWhereItem(null,and,null);
  }
  String[] results=Util.getPort().getItems(new WSGetItems(wsDataClusterPK,conceptName,wi,-1,0,Integer.MAX_VALUE)).getStrings();
  start=start < results.length ? start : results.length - 1;
  int end=results.length < (start + limit) ? results.length - 1 : (start + limit - 1);
  String[] subResults=end + 1 - start < limit ? new String[end + 1 - start] : new String[limit];
  for (int i=start, j=0; i < end + 1; i++, j++) {
    subResults[j]=results[i];
  }
  DataChangeLog[] data=new DataChangeLog[subResults.length];
  for (int i=0; i < data.length; i++) {
    DataChangeLog item=new DataChangeLog();
    String result=subResults[i];
    if (result != null) {
      Document doc=Util.parse(result);
      String userName=Util.getFirstTextNode(doc,"String_Node_Str");
      String source=Util.getFirstTextNode(doc,"String_Node_Str");
      String timeInMillis=Util.getFirstTextNode(doc,"String_Node_Str");
      String operationType=Util.getFirstTextNode(doc,"String_Node_Str");
      String revisionID=Util.getFirstTextNode(doc,"String_Node_Str");
      String dataCluster=Util.getFirstTextNode(doc,"String_Node_Str");
      String dataModel=Util.getFirstTextNode(doc,"String_Node_Str");
      String concept=Util.getFirstTextNode(doc,"String_Node_Str");
      String key=Util.getFirstTextNode(doc,"String_Node_Str");
      item.setUserName(userName);
      item.setSource(source);
      item.setTimeInMillis(timeInMillis);
      item.setOperationType(operationType);
      item.setRevisionID(revisionID);
      item.setDataCluster(dataCluster);
      item.setDataModel(dataModel);
      item.setConcept(concept);
      item.setKey(key);
      item.setIds(Util.joinStrings(new String[]{source,timeInMillis},"String_Node_Str"));
    }
    data[i]=item;
  }
  if (data.length <= 0) {
    listRange.setData(new DataChangeLog[0]);
    listRange.setTotalSize(0);
    return listRange;
  }
  listRange.setData(data);
  listRange.setTotalSize(results.length);
  return listRange;
}

Fixed version (ground truth):
public ListRange getUpdateReportList(int start,int limit,String sort,String dir,String regex) throws Exception {
  ListRange listRange=new ListRange();
  WSDataClusterPK wsDataClusterPK=new WSDataClusterPK(XSystemObjects.DC_UPDATE_PREPORT.getName());
  String conceptName="String_Node_Str";
  ArrayList<WSWhereItem> conditions=new ArrayList<WSWhereItem>();
  if (regex != null && regex.length() > 0) {
    JSONObject criteria=new JSONObject(regex);
    if (!criteria.isNull("String_Node_Str")) {
      String concept=(String)criteria.get("String_Node_Str");
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.CONTAINS,concept.trim(),WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String key=(String)criteria.get("String_Node_Str");
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.CONTAINS,key.trim(),WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String source=(String)criteria.get("String_Node_Str");
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.EQUALS,source.trim(),WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String operationType=(String)criteria.get("String_Node_Str");
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.EQUALS,operationType.trim(),WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String startDate=(String)criteria.get("String_Node_Str");
      SimpleDateFormat dataFmt=new SimpleDateFormat("String_Node_Str");
      Date date=dataFmt.parse(startDate);
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.GREATER_THAN_OR_EQUAL,date.getTime() + "String_Node_Str",WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
    if (!criteria.isNull("String_Node_Str")) {
      String endDate=(String)criteria.get("String_Node_Str");
      SimpleDateFormat dataFmt=new SimpleDateFormat("String_Node_Str");
      Date date=dataFmt.parse(endDate);
      WSWhereCondition wc=new WSWhereCondition("String_Node_Str",WSWhereOperator.LOWER_THAN_OR_EQUAL,date.getTime() + "String_Node_Str",WSStringPredicate.NONE,false);
      WSWhereItem wsWhereItem=new WSWhereItem(wc,null,null);
      conditions.add(wsWhereItem);
    }
  }
  WSWhereItem wi=null;
  if (conditions.size() == 0)   wi=null;
 else {
    WSWhereAnd and=new WSWhereAnd(conditions.toArray(new WSWhereItem[conditions.size()]));
    wi=new WSWhereItem(null,and,null);
  }
  String[] results=Util.getPort().getItems(new WSGetItems(wsDataClusterPK,conceptName,wi,-1,0,Integer.MAX_VALUE)).getStrings();
  start=start < results.length ? start : results.length - 1;
  if (start < 0)   start=0;
  int end=results.length < (start + limit) ? results.length - 1 : (start + limit - 1);
  String[] subResults=end + 1 - start < limit ? new String[end + 1 - start] : new String[limit];
  for (int i=start, j=0; i < end + 1; i++, j++) {
    subResults[j]=results[i];
  }
  DataChangeLog[] data=new DataChangeLog[subResults.length];
  for (int i=0; i < data.length; i++) {
    DataChangeLog item=new DataChangeLog();
    String result=subResults[i];
    if (result != null) {
      Document doc=Util.parse(result);
      String userName=Util.getFirstTextNode(doc,"String_Node_Str");
      String source=Util.getFirstTextNode(doc,"String_Node_Str");
      String timeInMillis=Util.getFirstTextNode(doc,"String_Node_Str");
      String operationType=Util.getFirstTextNode(doc,"String_Node_Str");
      String revisionID=Util.getFirstTextNode(doc,"String_Node_Str");
      String dataCluster=Util.getFirstTextNode(doc,"String_Node_Str");
      String dataModel=Util.getFirstTextNode(doc,"String_Node_Str");
      String concept=Util.getFirstTextNode(doc,"String_Node_Str");
      String key=Util.getFirstTextNode(doc,"String_Node_Str");
      item.setUserName(userName);
      item.setSource(source);
      item.setTimeInMillis(timeInMillis);
      item.setOperationType(operationType);
      item.setRevisionID(revisionID);
      item.setDataCluster(dataCluster);
      item.setDataModel(dataModel);
      item.setConcept(concept);
      item.setKey(key);
      item.setIds(Util.joinStrings(new String[]{source,timeInMillis},"String_Node_Str"));
    }
    data[i]=item;
  }
  if (data.length <= 0) {
    listRange.setData(new DataChangeLog[0]);
    listRange.setTotalSize(0);
    return listRange;
  }
  listRange.setData(data);
  listRange.setTotalSize(results.length);
  return listRange;
}