nus-yam/ex-repair huggingface dataset:
Program: 120736
Project: 120736
Buggy source:
/** 
 * delete, one time one record.
 */
public DeleteResult[] delete(String id) throws Exception {
  if (id == null)   return null;
  ID dID=new ID();
  dID.setID(id);
  deleteItems.add(dID);
  if (deleteItems.size() >= commitLevel) {
    ID[] delIDs=deleteItems.toArray(new ID[deleteItems.size()]);
    Delete dels=new Delete();
    dels.setIds(delIDs);
    DeleteResponse dresp=stub.delete(dels,sh,co,null,null,null,null,null,null,null,null);
    DeleteResult[] dr=dresp.getResult();
    deleteItems.clear();
    delIDs=null;
    if (dr != null && dr.length != 0) {
      for (      DeleteResult result : dr) {
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors());
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return dr;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * delete, one time one record.
 */
public DeleteResult[] delete(String id) throws Exception {
  if (id == null)   return null;
  ID dID=new ID();
  dID.setID(id);
  deleteItems.add(dID);
  if (deleteItems.size() >= commitLevel) {
    ID[] delIDs=deleteItems.toArray(new ID[deleteItems.size()]);
    changedItemKeys=new String[delIDs.length];
    for (int ix=0; ix < delIDs.length; ++ix) {
      changedItemKeys[ix]=delIDs[ix].getID();
    }
    Delete dels=new Delete();
    dels.setIds(delIDs);
    DeleteResponse dresp=stub.delete(dels,sh,co,null,null,null,null,null,null,null,null);
    DeleteResult[] dr=dresp.getResult();
    deleteItems.clear();
    delIDs=null;
    if (dr != null && dr.length != 0) {
      int batch_idx=-1;
      for (      DeleteResult result : dr) {
        ++batch_idx;
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors(),batch_idx < changedItemKeys.length ? changedItemKeys[batch_idx] : "String_Node_Str");
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return dr;
  }
  return null;
}
Program: 120738
Project: 120738
Buggy source:
private StringBuilder addLog(Error[] resultErrors) throws Exception {
  StringBuilder errors=new StringBuilder("String_Node_Str");
  if (resultErrors != null) {
    for (    Error error : resultErrors) {
      errors.append(error.getMessage()).append("String_Node_Str");
      if (logWriter != null) {
        logWriter.append("String_Node_Str").append(error.getStatusCode().toString());
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        if (error.getFields() != null) {
          boolean flag=false;
          for (          String field : error.getFields()) {
            if (flag) {
              logWriter.append("String_Node_Str");
            }
 else {
              flag=true;
            }
            logWriter.append(field);
          }
        }
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str").append(error.getMessage());
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        logWriter.newLine();
        logWriter.newLine();
      }
    }
  }
  return errors;
}

Fixed version (ground truth):
private StringBuilder addLog(Error[] resultErrors,String row_key) throws Exception {
  StringBuilder errors=new StringBuilder("String_Node_Str");
  if (resultErrors != null) {
    for (    Error error : resultErrors) {
      errors.append(error.getMessage()).append("String_Node_Str");
      if (logWriter != null) {
        logWriter.append("String_Node_Str").append(error.getStatusCode().toString());
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str" + row_key);
        if (error.getFields() != null) {
          logWriter.newLine();
          logWriter.append("String_Node_Str");
          boolean flag=false;
          for (          String field : error.getFields()) {
            if (flag) {
              logWriter.append("String_Node_Str");
            }
 else {
              flag=true;
            }
            logWriter.append(field);
          }
        }
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str").append(error.getMessage());
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        logWriter.newLine();
        logWriter.newLine();
      }
    }
  }
  return errors;
}
Program: 120740
Project: 120740
Buggy source:
public void keyPressed(KeyEvent e){
  if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
    e.doit=false;
    if (searchMaps.size() > 0) {
      if (!searchZoneMapper.isHightlightAll()) {
        searchZoneMapper.hightlightAll(searchMaps,false);
      }
 else {
        searchZoneMapper.hightlightAll(searchMaps,true);
      }
      searchMaps.clear();
    }
    searchZoneMapper.search(searchMaps,searchText.getText());
    selectKey=searchZoneMapper.selectHightlight(searchMaps,0,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void keyPressed(KeyEvent e){
  if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
    e.doit=false;
    if (searchMaps.size() > 0) {
      searchZoneMapper.hightlightAll(searchMaps,false);
      hightLightAllButton.setSelection(false);
      searchZoneMapper.setHightlightAll(hightLightAllButton.getSelection());
      searchMaps.clear();
    }
    searchZoneMapper.search(searchMaps,searchText.getText());
    selectKey=searchZoneMapper.selectHightlight(searchMaps,0,"String_Node_Str");
  }
}
Program: 120742
Project: 120742
Buggy source:
public void addCommonsComponents(){
  Label findLabel=new Label(composite,SWT.NONE);
  findLabel.setText("String_Node_Str");
  searchText=new Text(composite,SWT.BORDER);
  GridData gridData=new GridData();
  gridData.widthHint=150;
  searchText.setBackground(EntryState.NONE.getColor());
  searchText.setLayoutData(gridData);
  searchText.setToolTipText("String_Node_Str");
  ToolBar toolBarActions=new ToolBar(composite,SWT.FLAT | SWT.RIGHT);
  toolBarActions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  downTableButton=new ToolItem(toolBarActions,SWT.PUSH);
  downTableButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.DOWN_ICON)));
  downTableButton.setToolTipText("String_Node_Str");
  upTableButton=new ToolItem(toolBarActions,SWT.PUSH);
  upTableButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.UP_ICON)));
  upTableButton.setToolTipText("String_Node_Str");
  hightLightAllButton=new ToolItem(toolBarActions,SWT.CHECK);
  hightLightAllButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.CHECKED_ICON)));
  hightLightAllButton.setToolTipText("String_Node_Str");
  hightLightAllButton.setSelection(false);
  addCommonsComponentListeners();
}

Fixed version (ground truth):
public void addCommonsComponents(){
  Label findLabel=new Label(composite,SWT.NONE);
  findLabel.setText("String_Node_Str");
  searchText=new Text(composite,SWT.BORDER);
  GridData gridData=new GridData();
  gridData.widthHint=150;
  searchText.setBackground(EntryState.NONE.getColor());
  searchText.setLayoutData(gridData);
  searchText.setToolTipText("String_Node_Str");
  ToolBar toolBarActions=new ToolBar(composite,SWT.FLAT | SWT.RIGHT);
  toolBarActions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  downTableButton=new ToolItem(toolBarActions,SWT.PUSH);
  downTableButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.DOWN_ICON)));
  downTableButton.setToolTipText("String_Node_Str");
  upTableButton=new ToolItem(toolBarActions,SWT.PUSH);
  upTableButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.UP_ICON)));
  upTableButton.setToolTipText("String_Node_Str");
  hightLightAllButton=new ToolItem(toolBarActions,SWT.CHECK);
  hightLightAllButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.HIGHTLIGHT_ICON)));
  hightLightAllButton.setToolTipText("String_Node_Str");
  hightLightAllButton.setSelection(false);
  addCommonsComponentListeners();
}
Program: 120743
Project: 120743
Buggy source:
@Override public void layout(IFigure parent){
  List children=parent.getChildren();
  int numChildren=children.size();
  Rectangle clientArea=parent.getClientArea();
  int x=clientArea.x + spacing;
  int y=clientArea.y;
  Dimension prefSizes[]=new Dimension[numChildren];
  Dimension minSizes[]=new Dimension[numChildren];
  int wHint=-1;
  int hHint=-1;
  if (isHorizontal()) {
    hHint=parent.getClientArea(Rectangle.SINGLETON).height;
  }
 else {
    wHint=parent.getClientArea(Rectangle.SINGLETON).width;
  }
  IFigure child;
  int totalHeight=0;
  int totalMinHeight=0;
  int maxHeight=0;
  for (int i=0; i < numChildren; i++) {
    child=(IFigure)children.get(i);
    prefSizes[i]=getChildPreferredSize(child,wHint,hHint);
    minSizes[i]=getChildMinimumSize(child,wHint,hHint);
    totalHeight+=prefSizes[i].height;
    totalMinHeight+=minSizes[i].height;
    maxHeight=Math.max(maxHeight,prefSizes[i].height);
  }
  totalHeight+=(numChildren - 1) * spacing;
  totalMinHeight+=(numChildren - 1) * spacing;
  y=y + (clientArea.height - maxHeight) / 2;
  for (int i=0; i < numChildren; i++) {
    int prefHeight=prefSizes[i].height;
    int minHeight=minSizes[i].height;
    int prefWidth=prefSizes[i].width;
    if (i == 1) {
      prefWidth=220;
    }
    Rectangle newBounds=new Rectangle(x,y,prefWidth,prefHeight);
    child=(IFigure)children.get(i);
    child.setBounds(newBounds);
    x=x + newBounds.width + spacing;
  }
}

Fixed version (ground truth):
@Override public void layout(IFigure parent){
  List children=parent.getChildren();
  int numChildren=children.size();
  Rectangle clientArea=parent.getClientArea();
  int x=clientArea.x + spacing;
  int y=clientArea.y;
  Dimension prefSizes[]=new Dimension[numChildren];
  Dimension minSizes[]=new Dimension[numChildren];
  int wHint=-1;
  int hHint=-1;
  if (isHorizontal()) {
    hHint=parent.getClientArea(Rectangle.SINGLETON).height;
  }
 else {
    wHint=parent.getClientArea(Rectangle.SINGLETON).width;
  }
  IFigure child;
  int totalHeight=0;
  int totalMinHeight=0;
  int maxHeight=0;
  for (int i=0; i < numChildren; i++) {
    child=(IFigure)children.get(i);
    prefSizes[i]=getChildPreferredSize(child,wHint,hHint);
    minSizes[i]=getChildMinimumSize(child,wHint,hHint);
    totalHeight+=prefSizes[i].height;
    totalMinHeight+=minSizes[i].height;
    maxHeight=Math.max(maxHeight,prefSizes[i].height);
  }
  totalHeight+=(numChildren - 1) * spacing;
  totalMinHeight+=(numChildren - 1) * spacing;
  y=y + (clientArea.height - maxHeight) / 2;
  for (int i=0; i < numChildren; i++) {
    int prefHeight=prefSizes[i].height;
    int minHeight=minSizes[i].height;
    int prefWidth=prefSizes[i].width;
    if (i == 1) {
      prefWidth=200;
    }
    Rectangle newBounds=new Rectangle(x,y,prefWidth,prefHeight);
    child=(IFigure)children.get(i);
    child.setBounds(newBounds);
    x=x + newBounds.width + spacing;
  }
}
Program: 120744
Project: 120744
Buggy source:
public HightLightAllButton(){
  super(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.CHECKED_ICON)));
}

Fixed version (ground truth):
public HightLightAllButton(){
  super(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.HIGHTLIGHT_ICON)));
}
Program: 120746
Project: 120746
Buggy source:
/** 
 * DOC amaumont Comment method "colorExpressionFilterFromProblems".
 * @param table
 * @param colorAllowed TODO
 */
private void colorExpressionFilterFromProblems(AbstractInOutTable table,boolean colorAllowed){
  List<Problem> problems=table.getExpressionFilter().getProblems();
  if (problems != null && colorAllowed) {
    expressionFilterText.setColoring(false);
    expressionFilterText.setBackground(ColorProviderMapper.getColor(ColorInfo.COLOR_BACKGROUND_ERROR_EXPRESSION_CELL));
    expressionFilterText.setForeground(ColorProviderMapper.getColor(ColorInfo.COLOR_FOREGROUND_ERROR_EXPRESSION_CELL));
  }
 else {
    expressionFilterText.setColoring(true);
    expressionFilterText.setBackground(ColorProviderMapper.getColor(ColorInfo.COLOR_BACKGROUND_VALID_EXPRESSION_CELL));
    expressionFilterText.setForeground(ColorProviderMapper.getColor(ColorInfo.COLOR_FOREGROUND_VALID_EXPRESSION_CELL));
  }
}

Fixed version (ground truth):
/** 
 * DOC amaumont Comment method "colorExpressionFilterFromProblems".
 * @param table
 * @param colorAllowed TODO
 */
private void colorExpressionFilterFromProblems(AbstractInOutTable table,boolean colorAllowed){
  List<Problem> problems=table.getExpressionFilter().getProblems();
  if (problems != null && colorAllowed) {
    expressionFilterText.setColoring(false);
    if (!mapperManager.isSearchOption()) {
      expressionFilterText.setBackground(ColorProviderMapper.getColor(ColorInfo.COLOR_BACKGROUND_ERROR_EXPRESSION_CELL));
      expressionFilterText.setForeground(ColorProviderMapper.getColor(ColorInfo.COLOR_FOREGROUND_ERROR_EXPRESSION_CELL));
    }
  }
 else {
    expressionFilterText.setColoring(true);
    if (!mapperManager.isSearchOption()) {
      expressionFilterText.setBackground(ColorProviderMapper.getColor(ColorInfo.COLOR_BACKGROUND_VALID_EXPRESSION_CELL));
      expressionFilterText.setForeground(ColorProviderMapper.getColor(ColorInfo.COLOR_FOREGROUND_VALID_EXPRESSION_CELL));
    }
  }
}
Program: 120749
Project: 120749
Buggy source:
public void keyPressed(KeyEvent e){
  if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
    e.doit=false;
    if (searchMaps.size() > 0) {
      if (!searchZoneMapper.isHightlightAll()) {
        searchZoneMapper.hightlightAll(searchMaps,false);
      }
 else {
        searchZoneMapper.hightlightAll(searchMaps,true);
      }
      searchMaps.clear();
    }
    searchZoneMapper.search(searchMaps,searchText.getText());
    selectKey=searchZoneMapper.selectHightlight(searchMaps,0,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void keyPressed(KeyEvent e){
  if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
    e.doit=false;
    if (searchMaps.size() > 0) {
      searchZoneMapper.hightlightAll(searchMaps,false);
      hightLightAllButton.setSelection(false);
      searchZoneMapper.setHightlightAll(hightLightAllButton.getSelection());
      searchMaps.clear();
    }
    searchZoneMapper.search(searchMaps,searchText.getText());
    selectKey=searchZoneMapper.selectHightlight(searchMaps,0,"String_Node_Str");
  }
}
Program: 120750
Project: 120750
Buggy source:
public void handleEvent(Event event){
  if (searchMaps.isEmpty() && hightLightAllButton.getSelection()) {
    searchZoneMapper.search(searchMaps,searchText.getText());
  }
  searchZoneMapper.setHightlightAll(hightLightAllButton.getSelection());
  searchZoneMapper.hightlightAll(searchMaps,hightLightAllButton.getSelection());
}

Fixed version (ground truth):
public void handleEvent(Event event){
  if (searchMaps.isEmpty() && hightLightAllButton.getSelection()) {
    searchZoneMapper.search(searchMaps,searchText.getText());
  }
  mapperManager.setSearchOption(hightLightAllButton.getSelection());
  searchZoneMapper.setHightlightAll(hightLightAllButton.getSelection());
  searchZoneMapper.hightlightAll(searchMaps,hightLightAllButton.getSelection());
}
Program: 120752
Project: 120752
Buggy source:
public void addCommonsComponents(){
  Label findLabel=new Label(composite,SWT.NONE);
  findLabel.setText("String_Node_Str");
  searchText=new Text(composite,SWT.BORDER);
  GridData gridData=new GridData();
  gridData.widthHint=150;
  searchText.setBackground(EntryState.NONE.getColor());
  searchText.setLayoutData(gridData);
  searchText.setToolTipText("String_Node_Str");
  ToolBar toolBarActions=new ToolBar(composite,SWT.FLAT | SWT.RIGHT);
  toolBarActions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  downTableButton=new ToolItem(toolBarActions,SWT.PUSH);
  downTableButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.DOWN_ICON)));
  downTableButton.setToolTipText("String_Node_Str");
  upTableButton=new ToolItem(toolBarActions,SWT.PUSH);
  upTableButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.UP_ICON)));
  upTableButton.setToolTipText("String_Node_Str");
  hightLightAllButton=new ToolItem(toolBarActions,SWT.CHECK);
  hightLightAllButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.CHECKED_ICON)));
  hightLightAllButton.setToolTipText("String_Node_Str");
  hightLightAllButton.setSelection(false);
  addCommonsComponentListeners();
}

Fixed version (ground truth):
public void addCommonsComponents(){
  Label findLabel=new Label(composite,SWT.NONE);
  findLabel.setText("String_Node_Str");
  searchText=new Text(composite,SWT.BORDER);
  GridData gridData=new GridData();
  gridData.widthHint=150;
  searchText.setBackground(EntryState.NONE.getColor());
  searchText.setLayoutData(gridData);
  searchText.setToolTipText("String_Node_Str");
  ToolBar toolBarActions=new ToolBar(composite,SWT.FLAT | SWT.RIGHT);
  toolBarActions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  downTableButton=new ToolItem(toolBarActions,SWT.PUSH);
  downTableButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.DOWN_ICON)));
  downTableButton.setToolTipText("String_Node_Str");
  upTableButton=new ToolItem(toolBarActions,SWT.PUSH);
  upTableButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.UP_ICON)));
  upTableButton.setToolTipText("String_Node_Str");
  hightLightAllButton=new ToolItem(toolBarActions,SWT.CHECK);
  hightLightAllButton.setImage(org.talend.commons.ui.runtime.image.ImageProvider.getImage(org.talend.commons.ui.runtime.image.ImageProvider.getImageDesc(EImage.HIGHTLIGHT_ICON)));
  hightLightAllButton.setToolTipText("String_Node_Str");
  hightLightAllButton.setSelection(false);
  addCommonsComponentListeners();
}
Program: 120755
Project: 120755
Buggy source:
public void clear(){
  count=0;
  bufferList.clear();
}

Fixed version (ground truth):
public void clear(){
  count=0;
  bufferList.clear();
  markedMap.clear();
}
Program: 120757
Project: 120757
Buggy source:
/** 
 * create, one time one record.
 */
public SaveResult[] insert(String tablename,OMElement[] nameValues) throws Exception {
  if (tablename == null || tablename.trim().length() == 0)   return null;
  if (nameValues == null || nameValues.length == 0)   return null;
  SObject item=new SObject();
  item.setType(tablename);
  item.setExtraElement(nameValues);
  insertItems.add(item);
  if (insertItems.size() >= commitLevel) {
    SObject[] accs=insertItems.toArray(new SObject[insertItems.size()]);
    Create create=new Create();
    create.setSObjects(accs);
    SaveResult[] sr=stub.create(create,sh,co,null,null,null,null,null,null,null,null,null).getResult();
    insertItems.clear();
    accs=null;
    if (sr != null && sr.length != 0) {
      for (      SaveResult result : sr) {
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors());
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return sr;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * create, one time one record.
 */
public SaveResult[] insert(String tablename,OMElement[] nameValues) throws Exception {
  if (tablename == null || tablename.trim().length() == 0)   return null;
  if (nameValues == null || nameValues.length == 0)   return null;
  SObject item=new SObject();
  item.setType(tablename);
  item.setExtraElement(nameValues);
  insertItems.add(item);
  if (insertItems.size() >= commitLevel) {
    SObject[] accs=insertItems.toArray(new SObject[insertItems.size()]);
    changedItemKeys=new String[accs.length];
    Create create=new Create();
    create.setSObjects(accs);
    SaveResult[] sr=stub.create(create,sh,co,null,null,null,null,null,null,null,null,null).getResult();
    insertItems.clear();
    accs=null;
    if (sr != null && sr.length != 0) {
      int batch_idx=-1;
      for (      SaveResult result : sr) {
        ++batch_idx;
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors(),batch_idx < changedItemKeys.length ? "String_Node_Str" + (batch_idx + 1) : "String_Node_Str");
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return sr;
  }
  return null;
}
Program: 120758
Project: 120758
Buggy source:
/** 
 * update, one record, one time.
 */
public SaveResult[] update(String tablename,String idStr,OMElement[] updatefields,String[] fieldsToNull) throws Exception {
  SObject item=new SObject();
  item.setType(tablename);
  ID id=new ID();
  id.setID(idStr);
  item.setId(id);
  item.setExtraElement(updatefields);
  item.setFieldsToNull(fieldsToNull);
  updateItems.add(item);
  if (updateItems.size() >= commitLevel) {
    SObject[] upds=updateItems.toArray(new SObject[updateItems.size()]);
    Update update=new Update();
    update.setSObjects(upds);
    SaveResult[] saveResults=stub.update(update,sh,co,null,null,null,null,null,null,null,null,null).getResult();
    updateItems.clear();
    upds=null;
    if (exceptionForErrors && saveResults != null && saveResults.length != 0) {
      for (      SaveResult result : saveResults) {
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors());
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return saveResults;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * update, one record, one time.
 */
public SaveResult[] update(String tablename,String idStr,OMElement[] updatefields,String[] fieldsToNull) throws Exception {
  SObject item=new SObject();
  item.setType(tablename);
  ID id=new ID();
  id.setID(idStr);
  item.setId(id);
  item.setExtraElement(updatefields);
  item.setFieldsToNull(fieldsToNull);
  updateItems.add(item);
  if (updateItems.size() >= commitLevel) {
    SObject[] upds=updateItems.toArray(new SObject[updateItems.size()]);
    changedItemKeys=new String[upds.length];
    for (int ix=0; ix < upds.length; ++ix) {
      changedItemKeys[ix]=upds[ix].getId().getID();
    }
    Update update=new Update();
    update.setSObjects(upds);
    SaveResult[] saveResults=stub.update(update,sh,co,null,null,null,null,null,null,null,null,null).getResult();
    updateItems.clear();
    upds=null;
    if (saveResults != null && saveResults.length != 0) {
      int batch_idx=-1;
      for (      SaveResult result : saveResults) {
        ++batch_idx;
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors(),batch_idx < changedItemKeys.length ? changedItemKeys[batch_idx] : "String_Node_Str");
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return saveResults;
  }
  return null;
}
Program: 120759
Project: 120759
Buggy source:
/** 
 * delete, one time one record.
 */
public DeleteResult[] delete(String id) throws Exception {
  if (id == null)   return null;
  ID dID=new ID();
  dID.setID(id);
  deleteItems.add(dID);
  if (deleteItems.size() >= commitLevel) {
    ID[] delIDs=deleteItems.toArray(new ID[deleteItems.size()]);
    Delete dels=new Delete();
    dels.setIds(delIDs);
    DeleteResponse dresp=stub.delete(dels,sh,co,null,null,null,null,null,null,null,null);
    DeleteResult[] dr=dresp.getResult();
    deleteItems.clear();
    delIDs=null;
    if (dr != null && dr.length != 0) {
      for (      DeleteResult result : dr) {
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors());
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return dr;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * delete, one time one record.
 */
public DeleteResult[] delete(String id) throws Exception {
  if (id == null)   return null;
  ID dID=new ID();
  dID.setID(id);
  deleteItems.add(dID);
  if (deleteItems.size() >= commitLevel) {
    ID[] delIDs=deleteItems.toArray(new ID[deleteItems.size()]);
    changedItemKeys=new String[delIDs.length];
    for (int ix=0; ix < delIDs.length; ++ix) {
      changedItemKeys[ix]=delIDs[ix].getID();
    }
    Delete dels=new Delete();
    dels.setIds(delIDs);
    DeleteResponse dresp=stub.delete(dels,sh,co,null,null,null,null,null,null,null,null);
    DeleteResult[] dr=dresp.getResult();
    deleteItems.clear();
    delIDs=null;
    if (dr != null && dr.length != 0) {
      int batch_idx=-1;
      for (      DeleteResult result : dr) {
        ++batch_idx;
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors(),batch_idx < changedItemKeys.length ? changedItemKeys[batch_idx] : "String_Node_Str");
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return dr;
  }
  return null;
}
Program: 120761
Project: 120761
Buggy source:
private StringBuilder addLog(Error[] resultErrors) throws Exception {
  StringBuilder errors=new StringBuilder("String_Node_Str");
  if (resultErrors != null) {
    for (    Error error : resultErrors) {
      errors.append(error.getMessage()).append("String_Node_Str");
      if (logWriter != null) {
        logWriter.append("String_Node_Str").append(error.getStatusCode().toString());
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        if (error.getFields() != null) {
          boolean flag=false;
          for (          String field : error.getFields()) {
            if (flag) {
              logWriter.append("String_Node_Str");
            }
 else {
              flag=true;
            }
            logWriter.append(field);
          }
        }
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str").append(error.getMessage());
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        logWriter.newLine();
        logWriter.newLine();
      }
    }
  }
  return errors;
}

Fixed version (ground truth):
private StringBuilder addLog(Error[] resultErrors,String row_key) throws Exception {
  StringBuilder errors=new StringBuilder("String_Node_Str");
  if (resultErrors != null) {
    for (    Error error : resultErrors) {
      errors.append(error.getMessage()).append("String_Node_Str");
      if (logWriter != null) {
        logWriter.append("String_Node_Str").append(error.getStatusCode().toString());
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str" + row_key);
        if (error.getFields() != null) {
          logWriter.newLine();
          logWriter.append("String_Node_Str");
          boolean flag=false;
          for (          String field : error.getFields()) {
            if (flag) {
              logWriter.append("String_Node_Str");
            }
 else {
              flag=true;
            }
            logWriter.append(field);
          }
        }
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str").append(error.getMessage());
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        logWriter.newLine();
        logWriter.newLine();
      }
    }
  }
  return errors;
}
Program: 120762
Project: 120762
Buggy source:
@Override public Job refreshTemplates(){
  ILibraryManagerService librairesManagerService=(ILibraryManagerService)GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
  librairesManagerService.clearCache();
  ComponentCompilations.deleteMarkers();
  ComponentsFactoryProvider.getInstance().resetCache();
  Job job=CodeGeneratorEmittersPoolFactory.initialize();
  CorePlugin.getDefault().getLibrariesService().syncLibraries();
  IDesignerCoreService designerCoreService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
  designerCoreService.getLastGeneratedJobsDateMap().clear();
  return job;
}

Fixed version (ground truth):
@Override public Job refreshTemplates(){
  Element oldComponent=null;
  IComponentSettingsView viewer=null;
  if (!CommonUIPlugin.isFullyHeadless()) {
    viewer=(IComponentSettingsView)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IComponentSettingsView.ID);
    if (viewer != null) {
      oldComponent=viewer.getElement();
      viewer.cleanDisplay();
    }
  }
  ComponentCompilations.deleteMarkers();
  ComponentsFactoryProvider.getInstance().resetCache();
  ILibraryManagerService librairesManagerService=(ILibraryManagerService)GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
  librairesManagerService.clearCache();
  CorePlugin.getDefault().getLibrariesService().syncLibraries();
  Job job=CodeGeneratorEmittersPoolFactory.initialize();
  IDesignerCoreService designerCoreService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
  designerCoreService.getLastGeneratedJobsDateMap().clear();
  if (oldComponent != null) {
    viewer.setElement(oldComponent);
  }
  return job;
}
Program: 120763
Project: 120763
Buggy source:
@Override public void run(){
  IComponentSettingsView viewer=(IComponentSettingsView)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IComponentSettingsView.ID);
  Element oldComponent=null;
  if (viewer != null) {
    oldComponent=viewer.getElement();
    viewer.cleanDisplay();
  }
  ComponentCompilations.deleteMarkers();
  ComponentsFactoryProvider.getInstance().resetCache();
  CorePlugin.getDefault().getLibrariesService().syncLibraries();
  CodeGeneratorEmittersPoolFactory.initialize();
  IDesignerCoreService designerCoreService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
  designerCoreService.getLastGeneratedJobsDateMap().clear();
  if (oldComponent != null) {
    viewer.setElement(oldComponent);
  }
}

Fixed version (ground truth):
@Override public void run(){
  CodeGeneratorService service=new CodeGeneratorService();
  service.refreshTemplates();
}
Program: 120769
Project: 120769
Buggy source:
public void clear(){
  count=0;
  bufferList.clear();
}

Fixed version (ground truth):
public void clear(){
  count=0;
  bufferList.clear();
  markedMap.clear();
}
Program: 120774
Project: 120774
Buggy source:
public String generateSpringContent() throws CodeGeneratorException {
  if (process == null || !(process instanceof IProcess2)) {
    return null;
  }
  IProcess2 process2=(IProcess2)process;
  if (!process2.needsSpring() || process2.getSpringContent() == null) {
    return null;
  }
  return process2.getSpringContent();
}

Fixed version (ground truth):
@Override public String generateSpringContent() throws CodeGeneratorException {
  if (process == null || !(process instanceof IProcess2)) {
    return null;
  }
  IProcess2 process2=(IProcess2)process;
  if (!process2.needsSpring() || process2.getSpringContent() == null) {
    return null;
  }
  return process2.getSpringContent();
}
Program: 120775
Project: 120775
Buggy source:
public void setContextName(String contextName){
  this.contextName=contextName;
}

Fixed version (ground truth):
@Override public void setContextName(String contextName){
  this.contextName=contextName;
}
Program: 120781
Project: 120781
Buggy source:
public String generateSpringContent() throws CodeGeneratorException {
  if (process == null || !(process instanceof IProcess2)) {
    return null;
  }
  IProcess2 process2=(IProcess2)process;
  if (!process2.needsSpring() || process2.getSpringContent() == null) {
    return null;
  }
  return process2.getSpringContent();
}

Fixed version (ground truth):
@Override public String generateSpringContent() throws CodeGeneratorException {
  if (process == null || !(process instanceof IProcess2)) {
    return null;
  }
  IProcess2 process2=(IProcess2)process;
  if (!process2.needsSpring() || process2.getSpringContent() == null) {
    return null;
  }
  return process2.getSpringContent();
}
Program: 120782
Project: 120782
Buggy source:
public void setContextName(String contextName){
  this.contextName=contextName;
}

Fixed version (ground truth):
@Override public void setContextName(String contextName){
  this.contextName=contextName;
}
Program: 120786
Project: 120786
Buggy source:
public List<Map<String,String>> getQueryResult(String resultId) throws AsyncApiException, IOException {
  List<Map<String,String>> resultInfoList=new ArrayList<Map<String,String>>();
  Map<String,String> resultInfo;
  baseFileReader=new com.talend.csv.CSVReader(new java.io.BufferedReader(new java.io.InputStreamReader(connection.getQueryResultStream(job.getId(),batchInfoList.get(0).getId(),resultId),FILE_ENCODING)),',');
  if (baseFileReader.readNext()) {
    baseFileHeader=Arrays.asList(baseFileReader.getValues());
  }
  baseFileHeaderSize=baseFileHeader.size();
  String[] row;
  while (baseFileReader.readNext()) {
    if ((row=baseFileReader.getValues()) != null) {
      resultInfo=new HashMap<String,String>();
      for (int i=0; i < baseFileHeaderSize; i++) {
        resultInfo.put(baseFileHeader.get(i),row[i]);
      }
      resultInfoList.add(resultInfo);
    }
  }
  return resultInfoList;
}

Fixed version (ground truth):
public List<Map<String,String>> getQueryResult(String resultId) throws AsyncApiException, IOException {
  List<Map<String,String>> resultInfoList=new ArrayList<Map<String,String>>();
  Map<String,String> resultInfo;
  baseFileReader=new com.talend.csv.CSVReader(new java.io.BufferedReader(new java.io.InputStreamReader(connection.getQueryResultStream(job.getId(),batchInfoList.get(0).getId(),resultId),FILE_ENCODING)),',');
  if (baseFileReader.readNext()) {
    baseFileHeader=Arrays.asList(baseFileReader.getValues());
  }
  baseFileHeaderSize=baseFileHeader.size();
  String[] row;
  while (baseFileReader.readNext()) {
    if ((row=baseFileReader.getValues()) != null) {
      resultInfo=new HashMap<String,String>();
      for (int i=0; i < baseFileHeaderSize; i++) {
        resultInfo.put(baseFileHeader.get(i),row[i]);
      }
      resultInfoList.add(resultInfo);
    }
  }
  closeFileRead();
  return resultInfoList;
}
Program: 120789
Project: 120789
Buggy source:
/** 
 * create, one time one record.
 */
public SaveResult[] insert(String tablename,OMElement[] nameValues) throws Exception {
  if (tablename == null || tablename.trim().length() == 0)   return null;
  if (nameValues == null || nameValues.length == 0)   return null;
  SObject item=new SObject();
  item.setType(tablename);
  item.setExtraElement(nameValues);
  insertItems.add(item);
  if (insertItems.size() >= commitLevel) {
    SObject[] accs=insertItems.toArray(new SObject[insertItems.size()]);
    Create create=new Create();
    create.setSObjects(accs);
    SaveResult[] sr=stub.create(create,sh,co,null,null,null,null,null,null,null,null,null).getResult();
    insertItems.clear();
    accs=null;
    if (sr != null && sr.length != 0) {
      for (      SaveResult result : sr) {
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors());
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return sr;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * create, one time one record.
 */
public SaveResult[] insert(String tablename,OMElement[] nameValues) throws Exception {
  if (tablename == null || tablename.trim().length() == 0)   return null;
  if (nameValues == null || nameValues.length == 0)   return null;
  SObject item=new SObject();
  item.setType(tablename);
  item.setExtraElement(nameValues);
  insertItems.add(item);
  if (insertItems.size() >= commitLevel) {
    SObject[] accs=insertItems.toArray(new SObject[insertItems.size()]);
    changedItemKeys=new String[accs.length];
    Create create=new Create();
    create.setSObjects(accs);
    SaveResult[] sr=stub.create(create,sh,co,null,null,null,null,null,null,null,null,null).getResult();
    insertItems.clear();
    accs=null;
    if (sr != null && sr.length != 0) {
      int batch_idx=-1;
      for (      SaveResult result : sr) {
        ++batch_idx;
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors(),batch_idx < changedItemKeys.length ? "String_Node_Str" + (batch_idx + 1) : "String_Node_Str");
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return sr;
  }
  return null;
}
Program: 120790
Project: 120790
Buggy source:
/** 
 * update, one record, one time.
 */
public SaveResult[] update(String tablename,String idStr,OMElement[] updatefields,String[] fieldsToNull) throws Exception {
  SObject item=new SObject();
  item.setType(tablename);
  ID id=new ID();
  id.setID(idStr);
  item.setId(id);
  item.setExtraElement(updatefields);
  item.setFieldsToNull(fieldsToNull);
  updateItems.add(item);
  if (updateItems.size() >= commitLevel) {
    SObject[] upds=updateItems.toArray(new SObject[updateItems.size()]);
    Update update=new Update();
    update.setSObjects(upds);
    SaveResult[] saveResults=stub.update(update,sh,co,null,null,null,null,null,null,null,null,null).getResult();
    updateItems.clear();
    upds=null;
    if (exceptionForErrors && saveResults != null && saveResults.length != 0) {
      for (      SaveResult result : saveResults) {
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors());
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return saveResults;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * update, one record, one time.
 */
public SaveResult[] update(String tablename,String idStr,OMElement[] updatefields,String[] fieldsToNull) throws Exception {
  SObject item=new SObject();
  item.setType(tablename);
  ID id=new ID();
  id.setID(idStr);
  item.setId(id);
  item.setExtraElement(updatefields);
  item.setFieldsToNull(fieldsToNull);
  updateItems.add(item);
  if (updateItems.size() >= commitLevel) {
    SObject[] upds=updateItems.toArray(new SObject[updateItems.size()]);
    changedItemKeys=new String[upds.length];
    for (int ix=0; ix < upds.length; ++ix) {
      changedItemKeys[ix]=upds[ix].getId().getID();
    }
    Update update=new Update();
    update.setSObjects(upds);
    SaveResult[] saveResults=stub.update(update,sh,co,null,null,null,null,null,null,null,null,null).getResult();
    updateItems.clear();
    upds=null;
    if (saveResults != null && saveResults.length != 0) {
      int batch_idx=-1;
      for (      SaveResult result : saveResults) {
        ++batch_idx;
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors(),batch_idx < changedItemKeys.length ? changedItemKeys[batch_idx] : "String_Node_Str");
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return saveResults;
  }
  return null;
}
Program: 120791
Project: 120791
Buggy source:
/** 
 * delete, one time one record.
 */
public DeleteResult[] delete(String id) throws Exception {
  if (id == null)   return null;
  ID dID=new ID();
  dID.setID(id);
  deleteItems.add(dID);
  if (deleteItems.size() >= commitLevel) {
    ID[] delIDs=deleteItems.toArray(new ID[deleteItems.size()]);
    Delete dels=new Delete();
    dels.setIds(delIDs);
    DeleteResponse dresp=stub.delete(dels,sh,co,null,null,null,null,null,null,null,null);
    DeleteResult[] dr=dresp.getResult();
    deleteItems.clear();
    delIDs=null;
    if (dr != null && dr.length != 0) {
      for (      DeleteResult result : dr) {
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors());
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return dr;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * delete, one time one record.
 */
public DeleteResult[] delete(String id) throws Exception {
  if (id == null)   return null;
  ID dID=new ID();
  dID.setID(id);
  deleteItems.add(dID);
  if (deleteItems.size() >= commitLevel) {
    ID[] delIDs=deleteItems.toArray(new ID[deleteItems.size()]);
    changedItemKeys=new String[delIDs.length];
    for (int ix=0; ix < delIDs.length; ++ix) {
      changedItemKeys[ix]=delIDs[ix].getID();
    }
    Delete dels=new Delete();
    dels.setIds(delIDs);
    DeleteResponse dresp=stub.delete(dels,sh,co,null,null,null,null,null,null,null,null);
    DeleteResult[] dr=dresp.getResult();
    deleteItems.clear();
    delIDs=null;
    if (dr != null && dr.length != 0) {
      int batch_idx=-1;
      for (      DeleteResult result : dr) {
        ++batch_idx;
        StringBuilder errors=new StringBuilder("String_Node_Str");
        if (result.getSuccess()) {
        }
 else {
          errors=addLog(result.getErrors(),batch_idx < changedItemKeys.length ? changedItemKeys[batch_idx] : "String_Node_Str");
        }
        if (exceptionForErrors && errors.toString().length() > 0) {
          if (logWriter != null) {
            logWriter.close();
          }
          throw new Exception(errors.toString());
        }
      }
    }
    return dr;
  }
  return null;
}
Program: 120793
Project: 120793
Buggy source:
private StringBuilder addLog(Error[] resultErrors) throws Exception {
  StringBuilder errors=new StringBuilder("String_Node_Str");
  if (resultErrors != null) {
    for (    Error error : resultErrors) {
      errors.append(error.getMessage()).append("String_Node_Str");
      if (logWriter != null) {
        logWriter.append("String_Node_Str").append(error.getStatusCode().toString());
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        if (error.getFields() != null) {
          boolean flag=false;
          for (          String field : error.getFields()) {
            if (flag) {
              logWriter.append("String_Node_Str");
            }
 else {
              flag=true;
            }
            logWriter.append(field);
          }
        }
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str").append(error.getMessage());
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        logWriter.newLine();
        logWriter.newLine();
      }
    }
  }
  return errors;
}

Fixed version (ground truth):
private StringBuilder addLog(Error[] resultErrors,String row_key) throws Exception {
  StringBuilder errors=new StringBuilder("String_Node_Str");
  if (resultErrors != null) {
    for (    Error error : resultErrors) {
      errors.append(error.getMessage()).append("String_Node_Str");
      if (logWriter != null) {
        logWriter.append("String_Node_Str").append(error.getStatusCode().toString());
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str" + row_key);
        if (error.getFields() != null) {
          logWriter.newLine();
          logWriter.append("String_Node_Str");
          boolean flag=false;
          for (          String field : error.getFields()) {
            if (flag) {
              logWriter.append("String_Node_Str");
            }
 else {
              flag=true;
            }
            logWriter.append(field);
          }
        }
        logWriter.newLine();
        logWriter.newLine();
        logWriter.append("String_Node_Str").append(error.getMessage());
        logWriter.newLine();
        logWriter.append("String_Node_Str");
        logWriter.newLine();
        logWriter.newLine();
      }
    }
  }
  return errors;
}