nus-yam/ex-repair huggingface dataset:
Program: 120448
Project: 120448
Buggy source:
private JobInfo createJob() throws AsyncApiException {
  JobInfo job=new JobInfo();
  if (concurrencyMode != null)   job.setConcurrencyMode(concurrencyMode);
  job.setObject(sObjectType);
  job.setOperation(operation);
  if (OperationEnum.upsert.equals(operation)) {
    job.setExternalIdFieldName(externalIdFieldName);
  }
  job.setContentType(contentType);
  job=connection.createJob(job);
  return job;
}

Fixed version (ground truth):
private JobInfo createJob() throws AsyncApiException {
  JobInfo job=new JobInfo();
  if (concurrencyMode != null) {
    job.setConcurrencyMode(concurrencyMode);
  }
  job.setObject(sObjectType);
  job.setOperation(operation);
  if (OperationEnum.upsert.equals(operation)) {
    job.setExternalIdFieldName(externalIdFieldName);
  }
  job.setContentType(contentType);
  job=connection.createJob(job);
  return job;
}
Program: 120449
Project: 120449
Buggy source:
public void doBulkQuery(String moduleName,String queryStatement,int secToWait) throws AsyncApiException, InterruptedException {
  job=new JobInfo();
  job.setObject(moduleName);
  job.setOperation(OperationEnum.query);
  if (concurrencyMode != null)   job.setConcurrencyMode(concurrencyMode);
  job.setContentType(ContentType.CSV);
  job=connection.createJob(job);
  job=connection.getJobStatus(job.getId());
  batchInfoList=new ArrayList<BatchInfo>();
  BatchInfo info=null;
  ByteArrayInputStream bout=new ByteArrayInputStream(queryStatement.getBytes());
  info=connection.createBatchFromStream(job,bout);
  while (true) {
    Thread.sleep(secToWait * 1000);
    info=connection.getBatchInfo(job.getId(),info.getId());
    if (info.getState() == BatchStateEnum.Completed) {
      QueryResultList list=connection.getQueryResultList(job.getId(),info.getId());
      queryResultIDs=list.getResult();
      break;
    }
 else     if (info.getState() == BatchStateEnum.Failed) {
      throw new RuntimeException("String_Node_Str" + info);
    }
 else {
      System.out.println("String_Node_Str" + info);
    }
  }
  batchInfoList.add(info);
}

Fixed version (ground truth):
public void doBulkQuery(String moduleName,String queryStatement,int secToWait) throws AsyncApiException, InterruptedException {
  job=new JobInfo();
  job.setObject(moduleName);
  job.setOperation(OperationEnum.query);
  if (concurrencyMode != null) {
    job.setConcurrencyMode(concurrencyMode);
  }
  job.setContentType(ContentType.CSV);
  job=connection.createJob(job);
  job=connection.getJobStatus(job.getId());
  batchInfoList=new ArrayList<BatchInfo>();
  BatchInfo info=null;
  ByteArrayInputStream bout=new ByteArrayInputStream(queryStatement.getBytes());
  info=connection.createBatchFromStream(job,bout);
  while (true) {
    Thread.sleep(secToWait * 1000);
    info=connection.getBatchInfo(job.getId(),info.getId());
    if (info.getState() == BatchStateEnum.Completed) {
      QueryResultList list=connection.getQueryResultList(job.getId(),info.getId());
      queryResultIDs=list.getResult();
      break;
    }
 else     if (info.getState() == BatchStateEnum.Failed) {
      throw new RuntimeException("String_Node_Str" + info);
    }
 else {
      System.out.println("String_Node_Str" + info);
    }
  }
  batchInfoList.add(info);
  closeJob();
}
Program: 120450
Project: 120450
Buggy source:
private int countQuotes(String value){
  if (value == null || "String_Node_Str".equals(value)) {
    return 0;
  }
 else {
    char c='\"';
    int num=0;
    char[] chars=value.toCharArray();
    for (int i=0; i < chars.length; i++) {
      if (c == chars[i]) {
        num++;
      }
    }
    return num;
  }
}

Fixed version (ground truth):
private int countQuotes(String value){
  if (value == null || "String_Node_Str".equals(value)) {
    return 0;
  }
 else {
    char c='\"';
    int num=0;
    char[] chars=value.toCharArray();
    for (    char d : chars) {
      if (c == d) {
        num++;
      }
    }
    return num;
  }
}
Program: 120451
Project: 120451
Buggy source:
private void awaitCompletion() throws AsyncApiException {
  long sleepTime=0L;
  Set<String> incomplete=new HashSet<String>();
  for (  BatchInfo bi : batchInfoList) {
    incomplete.add(bi.getId());
  }
  while (!incomplete.isEmpty()) {
    try {
      Thread.sleep(sleepTime);
    }
 catch (    InterruptedException e) {
    }
    sleepTime=100L;
    BatchInfo[] statusList=connection.getBatchInfoList(job.getId()).getBatchInfo();
    for (    BatchInfo b : statusList) {
      if (b.getState() == BatchStateEnum.Completed || b.getState() == BatchStateEnum.Failed) {
        incomplete.remove(b.getId());
      }
    }
  }
}

Fixed version (ground truth):
private void awaitCompletion() throws AsyncApiException {
  long sleepTime=0L;
  Set<String> incomplete=new HashSet<String>();
  for (  BatchInfo bi : batchInfoList) {
    incomplete.add(bi.getId());
  }
  while (!incomplete.isEmpty()) {
    try {
      Thread.sleep(sleepTime);
    }
 catch (    InterruptedException e) {
    }
    sleepTime=awaitTime;
    BatchInfo[] statusList=connection.getBatchInfoList(job.getId()).getBatchInfo();
    for (    BatchInfo b : statusList) {
      if (b.getState() == BatchStateEnum.Completed || b.getState() == BatchStateEnum.Failed) {
        incomplete.remove(b.getId());
      }
    }
  }
}
Program: 120452
Project: 120452
Buggy source:
@Override public void loadUserComponentsFromComponentsProviderExtension(){
  ComponentsProviderManager.getInstance().getProviders();
  ComponentsProviderManager componentsProviderManager=ComponentsProviderManager.getInstance();
  AbstractComponentsProvider componentsProvider=componentsProviderManager.loadUserComponentsProvidersFromExtension();
  if (!this.userComponentList.isEmpty()) {
    ComponentsCache cache=ComponentManager.getComponentCache();
    for (    IComponent component : userComponentList) {
      if (componentList != null && componentList.contains(component)) {
        componentList.remove(component);
      }
      if (customComponentList.contains(component)) {
        customComponentList.remove(component);
      }
      if (cache.getComponentEntryMap().get(component.getName()) != null) {
        cache.getComponentEntryMap().remove(component.getName());
        ComponentManager.setModified(true);
      }
    }
  }
  loadComponents(componentsProvider);
  ComponentManager.saveResource();
}

Fixed version (ground truth):
@Override public void loadUserComponentsFromComponentsProviderExtension(){
  getComponents();
  ComponentsProviderManager.getInstance().getProviders();
  ComponentsProviderManager componentsProviderManager=ComponentsProviderManager.getInstance();
  AbstractComponentsProvider componentsProvider=componentsProviderManager.loadUserComponentsProvidersFromExtension();
  if (!this.userComponentList.isEmpty()) {
    ComponentsCache cache=ComponentManager.getComponentCache();
    for (    IComponent component : userComponentList) {
      if (componentList != null && componentList.contains(component)) {
        componentList.remove(component);
      }
      if (customComponentList.contains(component)) {
        customComponentList.remove(component);
      }
      if (cache.getComponentEntryMap().get(component.getName()) != null) {
        cache.getComponentEntryMap().remove(component.getName());
        ComponentManager.setModified(true);
      }
    }
  }
  loadComponents(componentsProvider);
  ComponentManager.saveResource();
}
Program: 120455
Project: 120455
Buggy source:
public void doBulkQuery(String moduleName,String queryStatement,int secToWait) throws AsyncApiException, InterruptedException {
  job=new JobInfo();
  job.setObject(moduleName);
  job.setOperation(OperationEnum.query);
  if (concurrencyMode != null) {
    job.setConcurrencyMode(concurrencyMode);
  }
  job.setContentType(ContentType.CSV);
  job=connection.createJob(job);
  job=connection.getJobStatus(job.getId());
  batchInfoList=new ArrayList<BatchInfo>();
  BatchInfo info=null;
  ByteArrayInputStream bout=new ByteArrayInputStream(queryStatement.getBytes());
  info=connection.createBatchFromStream(job,bout);
  while (true) {
    Thread.sleep(secToWait * 1000);
    info=connection.getBatchInfo(job.getId(),info.getId());
    if (info.getState() == BatchStateEnum.Completed) {
      QueryResultList list=connection.getQueryResultList(job.getId(),info.getId());
      queryResultIDs=list.getResult();
      break;
    }
 else     if (info.getState() == BatchStateEnum.Failed) {
      throw new RuntimeException("String_Node_Str" + info);
    }
 else {
      System.out.println("String_Node_Str" + info);
    }
  }
  batchInfoList.add(info);
}

Fixed version (ground truth):
public void doBulkQuery(String moduleName,String queryStatement,int secToWait) throws AsyncApiException, InterruptedException {
  job=new JobInfo();
  job.setObject(moduleName);
  job.setOperation(OperationEnum.query);
  if (concurrencyMode != null) {
    job.setConcurrencyMode(concurrencyMode);
  }
  job.setContentType(ContentType.CSV);
  job=connection.createJob(job);
  job=connection.getJobStatus(job.getId());
  batchInfoList=new ArrayList<BatchInfo>();
  BatchInfo info=null;
  ByteArrayInputStream bout=new ByteArrayInputStream(queryStatement.getBytes());
  info=connection.createBatchFromStream(job,bout);
  while (true) {
    Thread.sleep(secToWait * 1000);
    info=connection.getBatchInfo(job.getId(),info.getId());
    if (info.getState() == BatchStateEnum.Completed) {
      QueryResultList list=connection.getQueryResultList(job.getId(),info.getId());
      queryResultIDs=list.getResult();
      break;
    }
 else     if (info.getState() == BatchStateEnum.Failed) {
      throw new RuntimeException("String_Node_Str" + info);
    }
 else {
      System.out.println("String_Node_Str" + info);
    }
  }
  batchInfoList.add(info);
  closeJob();
}
Program: 120456
Project: 120456
Buggy source:
@Override public IJoinType[] getAvailableJoins(){
  List<IJoinType> joins=new ArrayList<IJoinType>();
  joins.addAll(Arrays.asList(super.getAvailableJoins()));
  joins.addAll(Arrays.asList(HIVEJOIN.values()));
  int superJoin=joins.indexOf(JOIN.INNER_JOIN);
  int currentJoin=joins.indexOf(HIVEJOIN.JOIN);
  Collections.swap(joins,superJoin,currentJoin);
  joins.remove(JOIN.INNER_JOIN);
  joins.remove(JOIN.CROSS_JOIN);
  return joins.toArray(new IJoinType[0]);
}

Fixed version (ground truth):
@Override public IJoinType[] getAvailableJoins(){
  List<IJoinType> joins=new ArrayList<IJoinType>();
  joins.addAll(Arrays.asList(super.getAvailableJoins()));
  joins.addAll(Arrays.asList(HIVEJOIN.values()));
  int superJoin=joins.indexOf(JOIN.INNER_JOIN);
  int currentJoin=joins.indexOf(HIVEJOIN.JOIN);
  Collections.swap(joins,superJoin,currentJoin);
  joins.remove(JOIN.INNER_JOIN);
  joins.remove(JOIN.CROSS_JOIN);
  joins.remove(JOIN.NO_JOIN);
  return joins.toArray(new IJoinType[0]);
}
Program: 120457
Project: 120457
Buggy source:
private String getOldValues(){
  return "String_Node_Str" + getDemoProjectName() + "String_Node_Str";
}

Fixed version (ground truth):
private String getOldValues(){
  return "String_Node_Str" + ResourcesPlugin.getWorkspace().getRoot().getLocation() + "String_Node_Str"+ getDemoProjectName()+ "String_Node_Str";
}
Program: 120459
Project: 120459
Buggy source:
public String getCurrentSchema(boolean sign){
  if (sign && schemaMap.get(currentSchema) != null && !"String_Node_Str".equals(schemaMap.get(currentSchema))) {
    return schemaMap.get(currentSchema);
  }
  return this.currentSchema;
}

Fixed version (ground truth):
@Override public String getCurrentSchema(boolean sign){
  if (sign && schemaMap.get(currentSchema) != null && !"String_Node_Str".equals(schemaMap.get(currentSchema))) {
    return schemaMap.get(currentSchema);
  }
  return this.currentSchema;
}
Program: 120460
Project: 120460
Buggy source:
protected HL7TreeNode addElement(HL7TreeNode current,String currentPath,String newPath,String defaultValue){
  String name=newPath.substring(newPath.lastIndexOf("String_Node_Str") + 1);
  String parentPath="String_Node_Str";
  if (newPath.contains("String_Node_Str")) {
    parentPath=newPath.substring(0,newPath.lastIndexOf("String_Node_Str"));
  }
  HL7TreeNode temp=new Element(name,defaultValue);
  if (current == null) {
    return temp;
  }
  if (currentPath.equals(parentPath)) {
    current.addChild(temp);
  }
 else {
    String[] nods=currentPath.split("String_Node_Str");
    String[] newNods=parentPath.split("String_Node_Str");
    int parentLevel=0;
    int checkLength=nods.length < newNods.length ? nods.length : newNods.length;
    for (int i=1; i < checkLength; i++) {
      if (nods[i].equals(newNods[i])) {
        parentLevel=i;
      }
    }
    HL7TreeNode parent=current;
    for (int i=0; i < nods.length - (parentLevel + 1); i++) {
      HL7TreeNode tmpParent=parent.getParent();
      if (tmpParent == null) {
        break;
      }
      parent=tmpParent;
    }
    if (parent != null)     parent.addChild(temp);
  }
  return temp;
}

Fixed version (ground truth):
protected HL7TreeNode addElement(HL7TreeNode current,String currentPath,String newPath,String defaultValue){
  String name=newPath.substring(newPath.lastIndexOf("String_Node_Str") + 1);
  String parentPath="String_Node_Str";
  if (newPath.contains("String_Node_Str")) {
    parentPath=newPath.substring(0,newPath.lastIndexOf("String_Node_Str"));
  }
  HL7TreeNode temp=new Element(name,defaultValue);
  if (current == null) {
    return temp;
  }
  if (currentPath.equals(parentPath)) {
    current.addChild(temp);
  }
 else {
    String[] nods=currentPath.split("String_Node_Str");
    String[] newNods=parentPath.split("String_Node_Str");
    int parentLevel=0;
    int checkLength=nods.length < newNods.length ? nods.length : newNods.length;
    for (int i=1; i < checkLength; i++) {
      if (nods[i].equals(newNods[i])) {
        parentLevel=i;
      }
    }
    HL7TreeNode parent=current;
    for (int i=0; i < nods.length - (parentLevel + 1); i++) {
      HL7TreeNode tmpParent=parent.getParent();
      if (tmpParent == null) {
        break;
      }
      parent=tmpParent;
    }
    if (parent != null) {
      parent.addChild(temp);
    }
  }
  return temp;
}
Program: 120462
Project: 120462
Buggy source:
public List<IMetadataColumn> getSchemaData(String currentSchema){
  List<? extends IConnection> incomingConnections=NodeUtil.getIncomingConnections(hl7Component,IConnectionCategory.FLOW);
  for (  IConnection connection : incomingConnections) {
    IMetadataTable metadataTable=connection.getMetadataTable();
    if (metadataTable.getLabel() != null && currentSchema != null && metadataTable.getLabel().equals(currentSchema)) {
      return metadataTable.getListColumns();
    }
  }
  return new ArrayList<IMetadataColumn>();
}

Fixed version (ground truth):
@Override public List<IMetadataColumn> getSchemaData(String currentSchema){
  List<? extends IConnection> incomingConnections=NodeUtil.getIncomingConnections(hl7Component,IConnectionCategory.FLOW);
  for (  IConnection connection : incomingConnections) {
    IMetadataTable metadataTable=connection.getMetadataTable();
    if (metadataTable.getLabel() != null && currentSchema != null && metadataTable.getLabel().equals(currentSchema)) {
      return metadataTable.getListColumns();
    }
  }
  return new ArrayList<IMetadataColumn>();
}
Program: 120464
Project: 120464
Buggy source:
public List getFirstLevelChild(Object parentElement){
  List values=new ArrayList();
  if (parentElement instanceof Message) {
    Message messParent=(Message)parentElement;
    String[] childNames=messParent.getNames();
    if (!values.isEmpty()) {
      values.clear();
    }
    for (int i=0; i < childNames.length; i++) {
      try {
        Structure[] childReps=messParent.getAll(childNames[i]);
        for (int j=0; j < childReps.length; j++) {
          if (childReps[j] instanceof Message) {
            values.add(childReps[j]);
          }
          if (childReps[j] instanceof Group) {
            allSegmentFromGroup.clear();
            getAllSegmentsFromGroup((Group)childReps[j]);
            if (allSegmentFromGroup.size() > 0) {
              values.addAll(Arrays.asList(allSegmentFromGroup.toArray(new SegmentModel[0])));
            }
          }
          if (childReps[j] instanceof Segment) {
            SegmentModel sModel=new SegmentModel((Segment)childReps[j],messParent,i,j);
            if (sModel.getTypes() != null && sModel.getTypes().length > 0) {
              values.add(sModel);
              if (!allSegmentsForMessage.contains(sModel)) {
                allSegmentsForMessage.add(sModel);
              }
            }
          }
        }
      }
 catch (      HL7Exception e) {
        e.printStackTrace();
      }
    }
  }
  return values;
}

Fixed version (ground truth):
public List getFirstLevelChild(Object parentElement){
  List values=new ArrayList();
  if (parentElement instanceof Message) {
    Message messParent=(Message)parentElement;
    String[] childNames=messParent.getNames();
    if (!values.isEmpty()) {
      values.clear();
    }
    for (int i=0; i < childNames.length; i++) {
      try {
        Structure[] childReps=messParent.getAll(childNames[i]);
        for (int j=0; j < childReps.length; j++) {
          if (childReps[j] instanceof Message) {
            values.add(childReps[j]);
          }
          if (childReps[j] instanceof Group) {
            values.add(childReps[j]);
            allSegmentFromGroup.clear();
            getAllSegmentsFromGroup((Group)childReps[j]);
          }
          if (childReps[j] instanceof Segment) {
            SegmentModel sModel=new SegmentModel((Segment)childReps[j],messParent,i,j);
            if (sModel.getTypes() != null && sModel.getTypes().length > 0) {
              values.add(sModel);
              if (!allSegmentsForMessage.contains(sModel)) {
                allSegmentsForMessage.add(sModel);
              }
            }
          }
        }
      }
 catch (      HL7Exception e) {
        e.printStackTrace();
      }
    }
  }
  return values;
}
Program: 120465
Project: 120465
Buggy source:
public HL7TreeNode cloneATreeNode(Object treeNode,String label){
  HL7TreeNode node=new Element();
  String nodeLabel=getLabel(treeNode,true);
  node.setLabel(nodeLabel);
  if (node instanceof Element) {
    ((Element)node).setRow(label);
  }
  node.setMain(true);
  Object[] children=getChildList(treeNode);
  if (children != null) {
    for (    Object element : children) {
      if (getChildList(element).length > 0) {
        HL7TreeNode childEle=cloneATreeNode(element,label);
        String tlabel=getLabel(element,true);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
        }
        node.addChild(childEle);
      }
 else {
        HL7TreeNode childEle=new Element();
        String tlabel=getLabel(element,false);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        childEle.setMain(false);
        node.addChild(childEle);
      }
    }
  }
  return node;
}

Fixed version (ground truth):
public HL7TreeNode cloneATreeNode(Object treeNode,String label){
  HL7TreeNode node=new Element();
  String nodeLabel=getLabel(treeNode,true);
  node.setLabel(nodeLabel);
  if (node instanceof Element) {
    ((Element)node).setRow(label);
  }
  node.setMain(true);
  Object[] children=getChildList(treeNode);
  if (children != null) {
    for (    Object element : children) {
      if (getChildList(element).length > 0) {
        HL7TreeNode childEle=cloneATreeNode(element,label);
        String tlabel=getLabel(element,true);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        node.addChild(childEle);
      }
 else {
        HL7TreeNode childEle=new Element();
        String tlabel=getLabel(element,false);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        childEle.setMain(false);
        node.addChild(childEle);
      }
    }
  }
  return node;
}
Program: 120472
Project: 120472
Buggy source:
public List getFirstLevelChild(Object parentElement){
  List values=new ArrayList();
  if (parentElement instanceof Message) {
    Message messParent=(Message)parentElement;
    String[] childNames=messParent.getNames();
    if (!values.isEmpty()) {
      values.clear();
    }
    for (int i=0; i < childNames.length; i++) {
      try {
        Structure[] childReps=messParent.getAll(childNames[i]);
        for (int j=0; j < childReps.length; j++) {
          if (childReps[j] instanceof Message) {
            values.add(childReps[j]);
          }
          if (childReps[j] instanceof Group) {
            allSegmentFromGroup.clear();
            getAllSegmentsFromGroup((Group)childReps[j]);
            if (allSegmentFromGroup.size() > 0) {
              values.addAll(Arrays.asList(allSegmentFromGroup.toArray(new SegmentModel[0])));
            }
          }
          if (childReps[j] instanceof Segment) {
            SegmentModel sModel=new SegmentModel((Segment)childReps[j],messParent,i,j);
            if (sModel.getTypes() != null && sModel.getTypes().length > 0) {
              values.add(sModel);
              if (!allSegmentsForMessage.contains(sModel)) {
                allSegmentsForMessage.add(sModel);
              }
            }
          }
        }
      }
 catch (      HL7Exception e) {
        e.printStackTrace();
      }
    }
  }
  return values;
}

Fixed version (ground truth):
public List getFirstLevelChild(Object parentElement){
  List values=new ArrayList();
  if (parentElement instanceof Message) {
    Message messParent=(Message)parentElement;
    String[] childNames=messParent.getNames();
    if (!values.isEmpty()) {
      values.clear();
    }
    for (int i=0; i < childNames.length; i++) {
      try {
        Structure[] childReps=messParent.getAll(childNames[i]);
        for (int j=0; j < childReps.length; j++) {
          if (childReps[j] instanceof Message) {
            values.add(childReps[j]);
          }
          if (childReps[j] instanceof Group) {
            values.add((Group)childReps[j]);
            allSegmentFromGroup.clear();
            getAllSegmentsFromGroup((Group)childReps[j]);
          }
          if (childReps[j] instanceof Segment) {
            SegmentModel sModel=new SegmentModel((Segment)childReps[j],messParent,i,j);
            if (sModel.getTypes() != null && sModel.getTypes().length > 0) {
              values.add(sModel);
              if (!allSegmentsForMessage.contains(sModel)) {
                allSegmentsForMessage.add(sModel);
              }
            }
          }
        }
      }
 catch (      HL7Exception e) {
        e.printStackTrace();
      }
    }
  }
  return values;
}
Program: 120473
Project: 120473
Buggy source:
public HL7TreeNode cloneATreeNode(Object treeNode,String label){
  HL7TreeNode node=new Element();
  String nodeLabel=getLabel(treeNode,true);
  node.setLabel(nodeLabel);
  if (node instanceof Element) {
    ((Element)node).setRow(label);
  }
  node.setMain(true);
  Object[] children=getChildList(treeNode);
  if (children != null) {
    for (    Object element : children) {
      if (getChildList(element).length > 0) {
        HL7TreeNode childEle=cloneATreeNode(element,label);
        String tlabel=getLabel(element,true);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
        }
        node.addChild(childEle);
      }
 else {
        HL7TreeNode childEle=new Element();
        String tlabel=getLabel(element,false);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        childEle.setMain(false);
        node.addChild(childEle);
      }
    }
  }
  return node;
}

Fixed version (ground truth):
public HL7TreeNode cloneATreeNode(Object treeNode,String label){
  HL7TreeNode node=new Element();
  String nodeLabel=getLabel(treeNode,true);
  node.setLabel(nodeLabel);
  if (node instanceof Element) {
    ((Element)node).setRow(label);
  }
  node.setMain(true);
  Object[] children=getChildList(treeNode);
  if (children != null) {
    for (    Object element : children) {
      if (getChildList(element).length > 0) {
        HL7TreeNode childEle=cloneATreeNode(element,label);
        String tlabel=getLabel(element,true);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        node.addChild(childEle);
      }
 else {
        HL7TreeNode childEle=new Element();
        String tlabel=getLabel(element,false);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        childEle.setMain(false);
        node.addChild(childEle);
      }
    }
  }
  return node;
}
Program: 120475
Project: 120475
Buggy source:
public void deleteAllJobs(boolean fromPluginModel){
  new DeleteAllJobWhenStartUp().startup(fromPluginModel);
}

Fixed version (ground truth):
@Override public void deleteAllJobs(boolean fromPluginModel){
  new DeleteAllJobWhenStartUp().startup(fromPluginModel);
}
Program: 120476
Project: 120476
Buggy source:
public void removeProcess(IProcess activeProcess){
  delegateService.removeProcess(activeProcess);
}

Fixed version (ground truth):
@Override public void removeProcess(IProcess activeProcess){
  delegateService.removeProcess(activeProcess);
}
Program: 120477
Project: 120477
Buggy source:
public String getRoutineFilenameExt(){
  return delegateService.getRoutineFilenameExt();
}

Fixed version (ground truth):
@Override public String getRoutineFilenameExt(){
  return delegateService.getRoutineFilenameExt();
}
Program: 120478
Project: 120478
Buggy source:
public IPerformanceData createPerformanceData(String data){
  return delegateService.createPerformanceData(data);
}

Fixed version (ground truth):
@Override public IPerformanceData createPerformanceData(String data){
  return delegateService.createPerformanceData(data);
}
Program: 120479
Project: 120479
Buggy source:
public boolean enableTraceForActiveRunProcess(){
  RunProcessContext activeContext=RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext();
  if (activeContext != null) {
    return activeContext.isMonitorTrace();
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean enableTraceForActiveRunProcess(){
  RunProcessContext activeContext=RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext();
  if (activeContext != null) {
    return activeContext.isMonitorTrace();
  }
  return false;
}
Program: 120480
Project: 120480
Buggy source:
public int perlExec(StringBuffer out,StringBuffer err,IPath absCodePath,String contextName,Level level,String perlInterpreterLibOption,String perlModuleDirectoryOption,int statOption,int traceOption,String... codeOptions) throws ProcessorException {
  return delegateService.perlExec(out,err,absCodePath,contextName,level,perlInterpreterLibOption,perlModuleDirectoryOption,statOption,traceOption,codeOptions);
}

Fixed version (ground truth):
@Override public int perlExec(StringBuffer out,StringBuffer err,IPath absCodePath,String contextName,Level level,String perlInterpreterLibOption,String perlModuleDirectoryOption,int statOption,int traceOption,String... codeOptions) throws ProcessorException {
  return delegateService.perlExec(out,err,absCodePath,contextName,level,perlInterpreterLibOption,perlModuleDirectoryOption,statOption,traceOption,codeOptions);
}
Program: 120481
Project: 120481
Buggy source:
public void setDelegateService(IRunProcessService delegateService){
  boolean isValidDelegate=delegateService != null && !(delegateService instanceof RunProcessService);
  if (isValidDelegate) {
    this.delegateService=delegateService;
  }
 else {
    throw new IllegalArgumentException(Messages.getString("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void setDelegateService(IRunProcessService delegateService){
  boolean isValidDelegate=delegateService != null && !(delegateService instanceof RunProcessService);
  if (isValidDelegate) {
    this.delegateService=delegateService;
  }
 else {
    throw new IllegalArgumentException(Messages.getString("String_Node_Str"));
  }
}
Program: 120482
Project: 120482
Buggy source:
public IAction getRunProcessAction(){
  return new RunProcessAction();
}

Fixed version (ground truth):
@Override public IAction getRunProcessAction(){
  return new RunProcessAction();
}
Program: 120483
Project: 120483
Buggy source:
public void updateLibraries(Set<String> jobModuleList,IProcess process){
  delegateService.updateLibraries(jobModuleList,process);
}

Fixed version (ground truth):
@Override public void updateLibraries(Set<String> jobModuleList,IProcess process){
  delegateService.updateLibraries(jobModuleList,process);
}
Program: 120484
Project: 120484
Buggy source:
public void saveJobBeforeRun(IProcess activeProcess){
  new SaveJobBeforeRunAction(activeProcess).run();
}

Fixed version (ground truth):
@Override public void saveJobBeforeRun(IProcess activeProcess){
  new SaveJobBeforeRunAction(activeProcess).run();
}
Program: 120485
Project: 120485
Buggy source:
public IJavaProject getJavaProject() throws CoreException {
  return delegateService.getJavaProject();
}

Fixed version (ground truth):
@Override public IJavaProject getJavaProject() throws CoreException {
  return delegateService.getJavaProject();
}
Program: 120486
Project: 120486
Buggy source:
public IPreferenceStore getPreferenceStore(){
  return RunProcessPlugin.getDefault().getPreferenceStore();
}

Fixed version (ground truth):
@Override public IPreferenceStore getPreferenceStore(){
  return RunProcessPlugin.getDefault().getPreferenceStore();
}
Program: 120487
Project: 120487
Buggy source:
public IProcessor createCodeProcessor(IProcess process,Property property,ECodeLanguage language,boolean filenameFromLabel){
  return delegateService.createCodeProcessor(process,property,language,filenameFromLabel);
}

Fixed version (ground truth):
@Override public IProcessor createCodeProcessor(IProcess process,Property property,ECodeLanguage language,boolean filenameFromLabel){
  return delegateService.createCodeProcessor(process,property,language,filenameFromLabel);
}
Program: 120488
Project: 120488
Buggy source:
public ICodeProblemsChecker getSyntaxChecker(ECodeLanguage codeLanguage){
  return delegateService.getSyntaxChecker(codeLanguage);
}

Fixed version (ground truth):
@Override public ICodeProblemsChecker getSyntaxChecker(ECodeLanguage codeLanguage){
  return delegateService.getSyntaxChecker(codeLanguage);
}
Program: 120489
Project: 120489
Buggy source:
public void refreshView(){
  delegateService.refreshView();
}

Fixed version (ground truth):
@Override public void refreshView(){
  delegateService.refreshView();
}
Program: 120490
Project: 120490
Buggy source:
public int getPauseTime(){
  return delegateService.getPauseTime();
}

Fixed version (ground truth):
@Override public int getPauseTime(){
  return delegateService.getPauseTime();
}
Program: 120491
Project: 120491
Buggy source:
public void setActiveProcess(IProcess2 activeProcess,boolean refreshUI){
  delegateService.setActiveProcess(activeProcess,refreshUI);
}

Fixed version (ground truth):
@Override public void setActiveProcess(IProcess2 activeProcess,boolean refreshUI){
  delegateService.setActiveProcess(activeProcess,refreshUI);
}
Program: 120492
Project: 120492
Buggy source:
public IContext getSelectedContext(){
  RunProcessContext activeContext=RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext();
  if (activeContext != null) {
    return activeContext.getSelectedContext();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public IContext getSelectedContext(){
  RunProcessContext activeContext=RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext();
  if (activeContext != null) {
    return activeContext.getSelectedContext();
  }
 else {
    return null;
  }
}
Program: 120493
Project: 120493
Buggy source:
public boolean needDeleteAllJobs(){
  return !DeleteAllJobWhenStartUp.executed;
}

Fixed version (ground truth):
@Override public boolean needDeleteAllJobs(){
  return !DeleteAllJobWhenStartUp.executed;
}
Program: 120494
Project: 120494
Buggy source:
public IProcess getActiveProcess(){
  if (RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext() == null) {
    return null;
  }
  return RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext().getProcess();
}

Fixed version (ground truth):
@Override public IProcess getActiveProcess(){
  if (RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext() == null) {
    return null;
  }
  return RunProcessPlugin.getDefault().getRunProcessContextManager().getActiveContext().getProcess();
}
Program: 120495
Project: 120495
Buggy source:
public boolean checkExportProcess(IStructuredSelection selection,boolean isJob){
  return delegateService.checkExportProcess(selection,isJob);
}

Fixed version (ground truth):
@Override public boolean checkExportProcess(IStructuredSelection selection,boolean isJob){
  return delegateService.checkExportProcess(selection,isJob);
}
Program: 120496
Project: 120496
Buggy source:
public IProject getProject(ECodeLanguage language) throws CoreException {
  return delegateService.getProject(language);
}

Fixed version (ground truth):
@Override public IProject getProject(ECodeLanguage language) throws CoreException {
  return delegateService.getProject(language);
}
Program: 120497
Project: 120497
Buggy source:
public String getCurrentSchema(boolean sign){
  if (sign && schemaMap.get(currentSchema) != null && !"String_Node_Str".equals(schemaMap.get(currentSchema))) {
    return schemaMap.get(currentSchema);
  }
  return this.currentSchema;
}

Fixed version (ground truth):
@Override public String getCurrentSchema(boolean sign){
  if (sign && schemaMap.get(currentSchema) != null && !"String_Node_Str".equals(schemaMap.get(currentSchema))) {
    return schemaMap.get(currentSchema);
  }
  return this.currentSchema;
}
Program: 120498
Project: 120498
Buggy source:
protected HL7TreeNode addElement(HL7TreeNode current,String currentPath,String newPath,String defaultValue){
  String name=newPath.substring(newPath.lastIndexOf("String_Node_Str") + 1);
  String parentPath="String_Node_Str";
  if (newPath.contains("String_Node_Str")) {
    parentPath=newPath.substring(0,newPath.lastIndexOf("String_Node_Str"));
  }
  HL7TreeNode temp=new Element(name,defaultValue);
  if (current == null) {
    return temp;
  }
  if (currentPath.equals(parentPath)) {
    current.addChild(temp);
  }
 else {
    String[] nods=currentPath.split("String_Node_Str");
    String[] newNods=parentPath.split("String_Node_Str");
    int parentLevel=0;
    int checkLength=nods.length < newNods.length ? nods.length : newNods.length;
    for (int i=1; i < checkLength; i++) {
      if (nods[i].equals(newNods[i])) {
        parentLevel=i;
      }
    }
    HL7TreeNode parent=current;
    for (int i=0; i < nods.length - (parentLevel + 1); i++) {
      HL7TreeNode tmpParent=parent.getParent();
      if (tmpParent == null) {
        break;
      }
      parent=tmpParent;
    }
    if (parent != null)     parent.addChild(temp);
  }
  return temp;
}

Fixed version (ground truth):
protected HL7TreeNode addElement(HL7TreeNode current,String currentPath,String newPath,String defaultValue){
  String name=newPath.substring(newPath.lastIndexOf("String_Node_Str") + 1);
  String parentPath="String_Node_Str";
  if (newPath.contains("String_Node_Str")) {
    parentPath=newPath.substring(0,newPath.lastIndexOf("String_Node_Str"));
  }
  HL7TreeNode temp=new Element(name,defaultValue);
  if (current == null) {
    return temp;
  }
  if (currentPath.equals(parentPath)) {
    current.addChild(temp);
  }
 else {
    String[] nods=currentPath.split("String_Node_Str");
    String[] newNods=parentPath.split("String_Node_Str");
    int parentLevel=0;
    int checkLength=nods.length < newNods.length ? nods.length : newNods.length;
    for (int i=1; i < checkLength; i++) {
      if (nods[i].equals(newNods[i])) {
        parentLevel=i;
      }
    }
    HL7TreeNode parent=current;
    for (int i=0; i < nods.length - (parentLevel + 1); i++) {
      HL7TreeNode tmpParent=parent.getParent();
      if (tmpParent == null) {
        break;
      }
      parent=tmpParent;
    }
    if (parent != null) {
      parent.addChild(temp);
    }
  }
  return temp;
}
Program: 120500
Project: 120500
Buggy source:
public List<IMetadataColumn> getSchemaData(String currentSchema){
  List<? extends IConnection> incomingConnections=NodeUtil.getIncomingConnections(hl7Component,IConnectionCategory.FLOW);
  for (  IConnection connection : incomingConnections) {
    IMetadataTable metadataTable=connection.getMetadataTable();
    if (metadataTable.getLabel() != null && currentSchema != null && metadataTable.getLabel().equals(currentSchema)) {
      return metadataTable.getListColumns();
    }
  }
  return new ArrayList<IMetadataColumn>();
}

Fixed version (ground truth):
@Override public List<IMetadataColumn> getSchemaData(String currentSchema){
  List<? extends IConnection> incomingConnections=NodeUtil.getIncomingConnections(hl7Component,IConnectionCategory.FLOW);
  for (  IConnection connection : incomingConnections) {
    IMetadataTable metadataTable=connection.getMetadataTable();
    if (metadataTable.getLabel() != null && currentSchema != null && metadataTable.getLabel().equals(currentSchema)) {
      return metadataTable.getListColumns();
    }
  }
  return new ArrayList<IMetadataColumn>();
}
Program: 120502
Project: 120502
Buggy source:
public List getFirstLevelChild(Object parentElement){
  List values=new ArrayList();
  if (parentElement instanceof Message) {
    Message messParent=(Message)parentElement;
    String[] childNames=messParent.getNames();
    if (!values.isEmpty()) {
      values.clear();
    }
    for (int i=0; i < childNames.length; i++) {
      try {
        Structure[] childReps=messParent.getAll(childNames[i]);
        for (int j=0; j < childReps.length; j++) {
          if (childReps[j] instanceof Message) {
            values.add(childReps[j]);
          }
          if (childReps[j] instanceof Group) {
            allSegmentFromGroup.clear();
            getAllSegmentsFromGroup((Group)childReps[j]);
            if (allSegmentFromGroup.size() > 0) {
              values.addAll(Arrays.asList(allSegmentFromGroup.toArray(new SegmentModel[0])));
            }
          }
          if (childReps[j] instanceof Segment) {
            SegmentModel sModel=new SegmentModel((Segment)childReps[j],messParent,i,j);
            if (sModel.getTypes() != null && sModel.getTypes().length > 0) {
              values.add(sModel);
              if (!allSegmentsForMessage.contains(sModel)) {
                allSegmentsForMessage.add(sModel);
              }
            }
          }
        }
      }
 catch (      HL7Exception e) {
        e.printStackTrace();
      }
    }
  }
  return values;
}

Fixed version (ground truth):
public List getFirstLevelChild(Object parentElement){
  List values=new ArrayList();
  if (parentElement instanceof Message) {
    Message messParent=(Message)parentElement;
    String[] childNames=messParent.getNames();
    if (!values.isEmpty()) {
      values.clear();
    }
    for (int i=0; i < childNames.length; i++) {
      try {
        Structure[] childReps=messParent.getAll(childNames[i]);
        for (int j=0; j < childReps.length; j++) {
          if (childReps[j] instanceof Message) {
            values.add(childReps[j]);
          }
          if (childReps[j] instanceof Group) {
            values.add(childReps[j]);
            allSegmentFromGroup.clear();
            getAllSegmentsFromGroup((Group)childReps[j]);
          }
          if (childReps[j] instanceof Segment) {
            SegmentModel sModel=new SegmentModel((Segment)childReps[j],messParent,i,j);
            if (sModel.getTypes() != null && sModel.getTypes().length > 0) {
              values.add(sModel);
              if (!allSegmentsForMessage.contains(sModel)) {
                allSegmentsForMessage.add(sModel);
              }
            }
          }
        }
      }
 catch (      HL7Exception e) {
        e.printStackTrace();
      }
    }
  }
  return values;
}
Program: 120503
Project: 120503
Buggy source:
public HL7TreeNode cloneATreeNode(Object treeNode,String label){
  HL7TreeNode node=new Element();
  String nodeLabel=getLabel(treeNode,true);
  node.setLabel(nodeLabel);
  if (node instanceof Element) {
    ((Element)node).setRow(label);
  }
  node.setMain(true);
  Object[] children=getChildList(treeNode);
  if (children != null) {
    for (    Object element : children) {
      if (getChildList(element).length > 0) {
        HL7TreeNode childEle=cloneATreeNode(element,label);
        String tlabel=getLabel(element,true);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
        }
        node.addChild(childEle);
      }
 else {
        HL7TreeNode childEle=new Element();
        String tlabel=getLabel(element,false);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        childEle.setMain(false);
        node.addChild(childEle);
      }
    }
  }
  return node;
}

Fixed version (ground truth):
public HL7TreeNode cloneATreeNode(Object treeNode,String label){
  HL7TreeNode node=new Element();
  String nodeLabel=getLabel(treeNode,true);
  node.setLabel(nodeLabel);
  if (node instanceof Element) {
    ((Element)node).setRow(label);
  }
  node.setMain(true);
  Object[] children=getChildList(treeNode);
  if (children != null) {
    for (    Object element : children) {
      if (getChildList(element).length > 0) {
        HL7TreeNode childEle=cloneATreeNode(element,label);
        String tlabel=getLabel(element,true);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        node.addChild(childEle);
      }
 else {
        HL7TreeNode childEle=new Element();
        String tlabel=getLabel(element,false);
        childEle.setLabel(tlabel);
        if (childEle instanceof Element) {
          ((Element)childEle).setRow(label);
          ((Element)childEle).setColumnName(getLabel(element,true));
        }
        childEle.setMain(false);
        node.addChild(childEle);
      }
    }
  }
  return node;
}
Program: 120509
Project: 120509
Buggy source:
public MessagesComposite(Composite parent,int style){
  super(parent,style);
  setLayout(new FormLayout());
  messageImage=new Label(this,SWT.NONE);
  FormData imageData=new FormData();
  imageData.left=new FormAttachment(0,H_SPACE_WIDTH);
  imageData.top=new FormAttachment(0,V_SPACE_WIDTH);
  messageImage.setLayoutData(imageData);
  messageLabel=new Label(this,SWT.NONE);
  FormData labelData=new FormData();
  labelData.left=new FormAttachment(messageImage,H_SPACE_WIDTH);
  labelData.top=new FormAttachment(0,V_SPACE_WIDTH);
  messageLabel.setLayoutData(labelData);
}

Fixed version (ground truth):
public MessagesComposite(Composite parent,int style){
  super(parent,style);
  setLayout(new GridLayout(3,false));
  messageImage=new Label(this,SWT.NONE);
  messageLabel=new Label(this,SWT.NONE);
  messageLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
Program: 120510
Project: 120510
Buggy source:
public MessagesWithActionComposite(Composite parent,int style){
  super(parent,style);
  actionBtn=new Button(this,SWT.PUSH);
  updateActionButton("String_Node_Str",null);
}

Fixed version (ground truth):
public MessagesWithActionComposite(Composite parent,int style){
  super(parent,style);
  actionBtn=new Button(this,SWT.PUSH);
  actionBtn.setLayoutData(new GridData());
  updateActionButton("String_Node_Str",null);
}
Program: 120511
Project: 120511
Buggy source:
public void setActionButtonVisible(boolean show){
  if (actionBtn != null && !actionBtn.isDisposed()) {
    actionBtn.setVisible(show);
    if (show) {
      FormData btnData=new FormData();
      btnData.right=new FormAttachment(100,-H_SPACE_WIDTH);
      btnData.top=new FormAttachment(0,V_SPACE_WIDTH);
      actionBtn.setLayoutData(btnData);
    }
  }
}

Fixed version (ground truth):
public void setActionButtonVisible(boolean show){
  if (actionBtn != null && !actionBtn.isDisposed()) {
    actionBtn.setVisible(show);
    GridData layoutData=(GridData)actionBtn.getLayoutData();
    if (layoutData == null) {
      layoutData=new GridData();
    }
    layoutData.exclude=!show;
    actionBtn.setLayoutData(layoutData);
    actionBtn.getParent().layout();
  }
}
Program: 120512
Project: 120512
Buggy source:
/** 
 * yzhang Comment method "getExpressionStorePath".
 * @return
 */
protected String getExpressionStorePath(){
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  RepositoryContext repositoryContext=(RepositoryContext)CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
  Project project=repositoryContext.getProject();
  IProject p=root.getProject(project.getTechnicalLabel());
  String projectPath=p.getLocation().toPortableString();
  String configurationPath=projectPath + File.separator + ExpressionPersistance.CONFIGURATION_FOLDER_NAME;
  configurationPath=getValidFolderPath(configurationPath,1);
  File configurationFolder=new File(configurationPath);
  if (!configurationFolder.exists()) {
    configurationFolder.mkdir();
  }
  String expressionPath=configurationPath + File.separator + ExpressionPersistance.EXPRESSION_FOLDER_NAME;
  expressionPath=getValidFolderPath(expressionPath,1);
  File expressionFolder=new File(expressionPath);
  if (!expressionFolder.exists()) {
    expressionFolder.mkdir();
  }
  String jobName="String_Node_Str";
  if (component != null) {
    jobName=component.getProcess().getName();
  }
 else {
    jobName="String_Node_Str";
  }
  expressionPath=expressionPath + File.separator + jobName+ XmlUtil.FILE_XML_SUFFIX;
  return expressionPath;
}

Fixed version (ground truth):
/** 
 * yzhang Comment method "getExpressionStorePath".
 * @return
 */
protected String getExpressionStorePath(){
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  RepositoryContext repositoryContext=(RepositoryContext)CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
  Project project=repositoryContext.getProject();
  IProject p=root.getProject(project.getTechnicalLabel());
  String projectPath=p.getLocation().toPortableString() + File.separator + RepositoryConstants.TEMP_DIRECTORY;
  String configurationPath=projectPath + File.separator + ExpressionPersistance.CONFIGURATION_FOLDER_NAME;
  configurationPath=getValidFolderPath(configurationPath,1);
  File configurationFolder=new File(configurationPath);
  if (!configurationFolder.exists()) {
    configurationFolder.mkdir();
  }
  String expressionPath=configurationPath + File.separator + ExpressionPersistance.EXPRESSION_FOLDER_NAME;
  expressionPath=getValidFolderPath(expressionPath,1);
  File expressionFolder=new File(expressionPath);
  if (!expressionFolder.exists()) {
    expressionFolder.mkdir();
  }
  String jobName="String_Node_Str";
  if (component != null) {
    jobName=component.getProcess().getName();
  }
 else {
    jobName="String_Node_Str";
  }
  expressionPath=expressionPath + File.separator + jobName+ XmlUtil.FILE_XML_SUFFIX;
  return expressionPath;
}