nus-yam/ex-repair huggingface dataset:
Program: 120683
Project: 120683
Buggy source:
@Override public boolean isEnabled(DropTargetEvent e){
  Object obj=getSelection().getFirstElement();
  if (obj instanceof RepositoryNode) {
    RepositoryNode sourceNode=(RepositoryNode)obj;
    if (PluginChecker.isCDCPluginLoaded()) {
      ICDCProviderService service=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
      if (service != null && (service.isSubscriberTableNode(sourceNode) || service.isSystemSubscriberTable(sourceNode))) {
        return false;
      }
    }
    IHadoopClusterService hadoopClusterService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
      hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
    }
    if (hadoopClusterService != null && hadoopClusterService.isHadoopClusterNode(sourceNode)) {
      return false;
    }
    IOozieService oozieService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IOozieService.class)) {
      oozieService=(IOozieService)GlobalServiceRegister.getDefault().getService(IOozieService.class);
    }
    if (oozieService != null && oozieService.isOozieNode(sourceNode)) {
      return false;
    }
  }
  return !this.editor.getProcess().isReadOnly();
}

Fixed version (ground truth):
@Override public boolean isEnabled(DropTargetEvent e){
  Object obj=getSelection().getFirstElement();
  if (obj instanceof RepositoryNode) {
    RepositoryNode sourceNode=(RepositoryNode)obj;
    if (PluginChecker.isCDCPluginLoaded()) {
      ICDCProviderService service=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
      if (service != null && (service.isSubscriberTableNode(sourceNode) || service.isSystemSubscriberTable(sourceNode))) {
        return false;
      }
    }
    IHadoopClusterService hadoopClusterService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
      hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
    }
    if (hadoopClusterService != null && hadoopClusterService.isHadoopClusterNode(sourceNode)) {
      return false;
    }
    IOozieService oozieService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IOozieService.class)) {
      oozieService=(IOozieService)GlobalServiceRegister.getDefault().getService(IOozieService.class);
    }
    if (oozieService != null && oozieService.isOozieNode(sourceNode)) {
      return false;
    }
    ISAPProviderService sapService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ISAPProviderService.class)) {
      sapService=(ISAPProviderService)GlobalServiceRegister.getDefault().getService(ISAPProviderService.class);
    }
    if (sapService != null && sapService.isSAPNode(sourceNode)) {
      return false;
    }
  }
  return !this.editor.getProcess().isReadOnly();
}
Program: 120684
Project: 120684
Buggy source:
@Override public List<? extends INode> getGeneratingNodes(){
  if (generatingProcess == null) {
    generatingProcess=new DataProcess(this);
  }
  List<INode> generatedNodeList=generatingProcess.getNodeList();
  if (isProcessModified() || routinesDependencies == null || routinesDependencies.isEmpty()) {
    checkRoutineDependencies();
  }
  if (isProcessModified()) {
    List<INode> sortedFlow=sortNodes(nodes);
    if (sortedFlow.size() != nodes.size()) {
      sortedFlow=nodes;
    }
    generatingProcess.buildFromGraphicalProcess(sortedFlow);
    generatedNodeList=generatingProcess.getNodeList();
    processModified=false;
  }
  return generatedNodeList;
}

Fixed version (ground truth):
@Override public List<? extends INode> getGeneratingNodes(){
  if (generatingProcess == null) {
    generatingProcess=new DataProcess(this);
  }
  List<INode> generatedNodeList=generatingProcess.getNodeList();
  if (isProcessModified() || routinesDependencies == null || routinesDependencies.isEmpty()) {
    checkRoutineDependencies();
  }
  if (isProcessModified()) {
    if (isBuilding()) {
      return generatedNodeList;
    }
    setBuilding(true);
    List<INode> sortedFlow=sortNodes(nodes);
    if (sortedFlow.size() != nodes.size()) {
      sortedFlow=nodes;
    }
    generatingProcess.buildFromGraphicalProcess(sortedFlow);
    generatedNodeList=generatingProcess.getNodeList();
    processModified=false;
    setBuilding(false);
  }
  return generatedNodeList;
}
Program: 120685
Project: 120685
Buggy source:
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  document.set(generatedCode);
  return org.eclipse.core.runtime.Status.OK_STATUS;
}

Fixed version (ground truth):
@Override public IStatus runInUIThread(IProgressMonitor monitor){
  document.set(generatedCode);
  setGenerating(false);
  return org.eclipse.core.runtime.Status.OK_STATUS;
}
Program: 120686
Project: 120686
Buggy source:
public static void refreshCodeView(final IElement element){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(CodeView.ID);
  if (view != null) {
    final CodeView codeView=(CodeView)view;
    codeView.getViewSite().getShell().getDisplay().asyncExec(new Runnable(){
      @Override public void run(){
        codeView.refresh(element);
      }
    }
);
  }
}

Fixed version (ground truth):
public static void refreshCodeView(final IElement element){
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.findView(CodeView.ID);
  if (view != null) {
    final CodeView codeView=(CodeView)view;
    codeView.refresh(element);
  }
}
Program: 120689
Project: 120689
Buggy source:
@Override public void done(IJobChangeEvent event){
  new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      document.set(generatedCode);
      return org.eclipse.core.runtime.Status.OK_STATUS;
    }
  }
.schedule();
}

Fixed version (ground truth):
@Override public void done(IJobChangeEvent event){
  new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      document.set(generatedCode);
      setGenerating(false);
      return org.eclipse.core.runtime.Status.OK_STATUS;
    }
  }
.schedule();
}
Program: 120690
Project: 120690
Buggy source:
/** 
 * DOC qwei Comment method "addParameters".
 * @param schemaBean
 * @param parameters
 */
private void addParameters(WSDLSchemaBean schemaBean,ArrayList parameters){
  IElementParameter param=new TextElementParameter("String_Node_Str",schemaBean.getWslUrl());
  addParameter(param);
  if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA)) {
    addJavaParameters(schemaBean);
  }
 else   if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL)) {
    addPerlParameters(schemaBean);
  }
  param=new TextElementParameter("String_Node_Str",schemaBean.getMethod());
  addParameter(param);
  param=new TextElementParameter("String_Node_Str",Boolean.toString(false));
  addParameter(param);
  List<Map<String,Object>> list=new ArrayList<Map<String,Object>>();
  for (  Object string : parameters) {
    Map<String,Object> map=new HashMap<String,Object>();
    map.put("String_Node_Str",TalendTextUtils.addQuotes(string.toString()));
    list.add(map);
  }
  param=new ObjectElementParameter("String_Node_Str",list);
  param.setListItemsDisplayCodeName(new String[]{"String_Node_Str"});
  addParameter(param);
}

Fixed version (ground truth):
/** 
 * DOC qwei Comment method "addParameters".
 * @param schemaBean
 * @param parameters
 */
private void addParameters(WSDLSchemaBean schemaBean,ArrayList parameters){
  IElementParameter param=new TextElementParameter("String_Node_Str",schemaBean.getWslUrl());
  addParameter(param);
  if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA)) {
    addJavaParameters(schemaBean);
  }
 else   if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL)) {
    addPerlParameters(schemaBean);
  }
  param=new TextElementParameter("String_Node_Str",schemaBean.getMethod());
  addParameter(param);
  param=new TextElementParameter("String_Node_Str",Boolean.toString(false));
  addParameter(param);
  List<Map<String,Object>> list=new ArrayList<Map<String,Object>>();
  if (parameters != null) {
    for (    Object string : parameters) {
      Map<String,Object> map=new HashMap<String,Object>();
      map.put("String_Node_Str",TalendTextUtils.addQuotes(string.toString()));
      list.add(map);
    }
  }
  param=new ObjectElementParameter("String_Node_Str",list);
  param.setListItemsDisplayCodeName(new String[]{"String_Node_Str"});
  addParameter(param);
}
Program: 120692
Project: 120692
Buggy source:
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitorWrap=new EventLoopProgressMonitor(monitor);
  try {
    DemoProjectBean demoProjectBean=demoProjectList.get(selectedDemoProjectIndex);
    String projectName=demoProjectBean.getProjectName();
    if (checkProjectIsExisting(projectName)) {
      boolean reImportFlag=MessageDialog.openQuestion(shell,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
      if (!reImportFlag) {
        return;
      }
    }
    String demoFilePath=demoProjectBean.getDemoProjectFilePath();
    EDemoProjectFileType demoProjectFileType=demoProjectBean.getDemoProjectFileType();
    String pluginID=demoProjectBean.getPluginId();
    Bundle bundle=Platform.getBundle(pluginID);
    URL url=FileLocator.resolve(bundle.getEntry(demoFilePath));
    String filePath=new Path(url.getFile()).toOSString();
    String technicalName=ProjectManager.getLocalTechnicalProjectName(projectName);
    if (demoProjectFileType.equals(EDemoProjectFileType.FOLDER)) {
      ImportProjectsUtilities.importProjectAs(shell,projectName,technicalName,filePath,monitorWrap);
    }
 else {
      ImportProjectsUtilities.importArchiveProjectAs(shell,projectName,technicalName,filePath,monitorWrap);
    }
    lastImportedName=projectName;
  }
 catch (  IOException e) {
    throw new InvocationTargetException(e);
  }
catch (  TarException e) {
    throw new InvocationTargetException(e);
  }
  monitorWrap.done();
  MessageDialog.openInformation(shell,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
  PreferenceManipulator prefManipulator=new PreferenceManipulator(CorePlugin.getDefault().getPreferenceStore());
  prefManipulator.setValue(DEMO_ALREADY_IMPORTED,true);
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitorWrap=new EventLoopProgressMonitor(monitor);
  try {
    DemoProjectBean demoProjectBean=demoProjectList.get(selectedDemoProjectIndex);
    String projectName=demoProjectBean.getProjectName();
    if (checkProjectIsExisting(projectName)) {
      boolean reImportFlag=MessageDialog.openQuestion(shell,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
      if (!reImportFlag) {
        return;
      }
    }
    ImportProjectsUtilities.importDemoProject(shell,projectName,demoProjectBean,monitor);
    lastImportedName=projectName;
  }
 catch (  Exception e) {
    throw new InvocationTargetException(e);
  }
  monitorWrap.done();
  MessageDialog.openInformation(shell,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
  PreferenceManipulator prefManipulator=new PreferenceManipulator(CorePlugin.getDefault().getPreferenceStore());
  prefManipulator.setValue(DEMO_ALREADY_IMPORTED,true);
}
Program: 120694
Project: 120694
Buggy source:
private boolean dropVarsEntryIsValid(TableItem tableItemTarget){
  Table table=tableItemTarget.getParent();
  TableItem[] tableItems=table.getItems();
  for (int i=0; i < tableItems.length; i++) {
    if (tableItemTarget == tableItems[i]) {
      break;
    }
    if (tableItemSource == tableItems[i]) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean dropVarsEntryIsValid(TableItem tableItemTarget){
  Table table=tableItemTarget.getParent();
  TableItem[] tableItems=table.getItems();
  for (  TableItem tableItem : tableItems) {
    if (tableItemTarget == tableItem) {
      break;
    }
    if (tableItemSource == tableItem) {
      return true;
    }
  }
  return false;
}
Program: 120696
Project: 120696
Buggy source:
private void addTreeCheckedSelection(){
  CheckboxTreeViewer exportItemsTreeViewer=getItemsTreeViewer();
  exportItemsTreeViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      refreshExportDependNodes();
    }
  }
);
}

Fixed version (ground truth):
private void addTreeCheckedSelection(){
  CheckboxTreeViewer exportItemsTreeViewer=getItemsTreeViewer();
  exportItemsTreeViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      refreshExportDependNodes();
    }
  }
);
}
Program: 120697
Project: 120697
Buggy source:
public void run(){
  CheckboxTreeViewer exportItemsTreeViewer=getItemsTreeViewer();
  Set<RepositoryNode> nodes=new HashSet<RepositoryNode>();
  nodes.addAll(repositoryNodes);
  nodes.addAll(checkedNodes);
  exportItemsTreeViewer.setCheckedElements(nodes.toArray());
}

Fixed version (ground truth):
@Override public void run(){
  CheckboxTreeViewer exportItemsTreeViewer=getItemsTreeViewer();
  Set<RepositoryNode> nodes=new HashSet<RepositoryNode>();
  nodes.addAll(repositoryNodes);
  nodes.addAll(checkedNodes);
  exportItemsTreeViewer.setCheckedElements(nodes.toArray());
}
Program: 120699
Project: 120699
Buggy source:
public void keyTraversed(TraverseEvent e){
  if (e.detail == SWT.TRAVERSE_RETURN) {
    e.doit=false;
    lastPath=archivePathField.getText().trim();
  }
}

Fixed version (ground truth):
@Override public void keyTraversed(TraverseEvent e){
  if (e.detail == SWT.TRAVERSE_RETURN) {
    e.doit=false;
    lastPath=archivePathField.getText().trim();
  }
}
Program: 120700
Project: 120700
Buggy source:
public void createControl(Composite parent){
  TimeMeasure.begin(this.getClass().getSimpleName());
  Composite workArea=new Composite(parent,SWT.NONE);
  setControl(workArea);
  workArea.setLayout(new GridLayout());
  workArea.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
  createItemRoot(workArea);
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  createItemList(workArea);
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  TimeMeasure.end(this.getClass().getSimpleName());
  TimeMeasure.display=false;
  TimeMeasure.displaySteps=false;
  TimeMeasure.measureActive=false;
}

Fixed version (ground truth):
@Override public void createControl(Composite parent){
  TimeMeasure.begin(this.getClass().getSimpleName());
  Composite workArea=new Composite(parent,SWT.NONE);
  setControl(workArea);
  workArea.setLayout(new GridLayout());
  workArea.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
  createItemRoot(workArea);
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  createItemList(workArea);
  TimeMeasure.step(this.getClass().getSimpleName(),"String_Node_Str");
  TimeMeasure.end(this.getClass().getSimpleName());
  TimeMeasure.display=false;
  TimeMeasure.displaySteps=false;
  TimeMeasure.measureActive=false;
}
Program: 120701
Project: 120701
Buggy source:
public void modifyText(ModifyEvent e){
  saveExportPath(ARCHIVE_PATH,archivePathField.getText());
}

Fixed version (ground truth):
@Override public void modifyText(ModifyEvent e){
  saveExportPath(ARCHIVE_PATH,archivePathField.getText());
}
Program: 120702
Project: 120702
Buggy source:
public void selectionChanged(SelectionChangedEvent event){
  refreshExportDependNodes();
}

Fixed version (ground truth):
@Override public void selectionChanged(SelectionChangedEvent event){
  refreshExportDependNodes();
}
Program: 120704
Project: 120704
Buggy source:
public boolean performFinish(){
  if (!checkExportFile()) {
    return false;
  }
  ProjectManager pManager=ProjectManager.getInstance();
  Project project=pManager.getCurrentProject().getEmfProject();
  String projectPath=lastPath + "String_Node_Str" + project.getTechnicalLabel();
  if (new File(projectPath).exists() || new File(archivePathField.getText()).exists()) {
    File oldFile=new File(projectPath).exists() ? new File(projectPath) : new File(archivePathField.getText());
    if (MessageDialogWithToggle.openConfirm(null,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"))) {
      deleteFile(oldFile);
    }
 else {
      return false;
    }
  }
  Collection<Item> selectedItems=getSelectedItems();
  try {
    ExportItemUtil exportItemUtil=new ExportItemUtil();
    exportItemUtil.exportItems(new File(lastPath),selectedItems,true,new NullProgressMonitor());
  }
 catch (  Exception e) {
    MessageBoxExceptionHandler.process(e);
  }
  return true;
}

Fixed version (ground truth):
public boolean performFinish(){
  if (!checkExportFile()) {
    return false;
  }
  ProjectManager pManager=ProjectManager.getInstance();
  Project project=pManager.getCurrentProject().getEmfProject();
  String projectPath=lastPath + "String_Node_Str" + project.getTechnicalLabel();
  if (new File(projectPath).exists() || new File(archivePathField.getText()).exists()) {
    File oldFile=new File(projectPath).exists() ? new File(projectPath) : new File(archivePathField.getText());
    if (MessageDialogWithToggle.openConfirm(null,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"))) {
      deleteFile(oldFile);
    }
 else {
      return false;
    }
  }
  Collection<Item> selectedItems=getSelectedItems();
  try {
    ExportItemUtil exportItemUtil=new ExportItemUtil();
    if (itemFromArchiveRadio.getSelection()) {
      if (lastPath != null && !lastPath.endsWith(FileConstants.TAR_FILE_SUFFIX) && !lastPath.endsWith(FileConstants.TAR_GZ_FILE_SUFFIX) && !lastPath.endsWith(FileConstants.ZIP_FILE_SUFFIX)) {
        lastPath=lastPath + FileConstants.ZIP_FILE_SUFFIX;
      }
    }
    exportItemUtil.exportItems(new File(lastPath),selectedItems,true,new NullProgressMonitor());
  }
 catch (  Exception e) {
    MessageBoxExceptionHandler.process(e);
  }
  return true;
}
Program: 120706
Project: 120706
Buggy source:
protected List getModelChildren(){
  List<Element> elements;
  elements=new ArrayList<Element>();
  elements.add(((Connection)getModel()).getConnectionLabel());
  elements.add(((Connection)getModel()).getPerformance());
  if (((Connection)getModel()).getResuming() != null) {
    elements.add(((Connection)getModel()).getResuming());
  }
  if (((Connection)getModel()).getConnectionTrace() != null) {
    elements.add(((Connection)getModel()).getConnectionTrace());
  }
  if (((Connection)getModel()).isMonitorConnection()) {
    elements.add(((Connection)getModel()).getMonitorLabel());
  }
  return elements;
}

Fixed version (ground truth):
@Override protected List getModelChildren(){
  List<Element> elements;
  elements=new ArrayList<Element>();
  elements.add(((Connection)getModel()).getConnectionLabel());
  elements.add(((Connection)getModel()).getPerformance());
  EditPart contents=getRoot().getContents();
  boolean monitorSupport=true;
  if (contents.getModel() instanceof IProcess) {
    IProcess currentProcess=(IProcess)contents.getModel();
    if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().endsWith(currentProcess.getComponentsType())) {
      monitorSupport=false;
    }
  }
  if (monitorSupport) {
    if (((Connection)getModel()).getResuming() != null) {
      elements.add(((Connection)getModel()).getResuming());
    }
    if (((Connection)getModel()).getConnectionTrace() != null) {
      elements.add(((Connection)getModel()).getConnectionTrace());
    }
    if (((Connection)getModel()).isMonitorConnection()) {
      elements.add(((Connection)getModel()).getMonitorLabel());
    }
  }
  return elements;
}
Program: 120707
Project: 120707
Buggy source:
public void setSelected(final int value){
  super.setSelected(value);
  List cl=this.getChildren();
  for (int i=0; i < cl.size(); i++) {
    if (((EditPart)cl.get(i)).getSelected() != value) {
      ((EditPart)cl.get(i)).setSelected(value);
    }
  }
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  if (value == SELECTED_PRIMARY) {
    IViewPart view=page.findView(ComponentSettingsView.ID);
    if (view != null) {
      ComponentSettingsView compSettings=(ComponentSettingsView)view;
      compSettings.setElement((Connection)getModel());
      CodeView.refreshCodeView((Connection)getModel());
    }
  }
 else   if (value == SELECTED_NONE) {
    IViewPart view=page.findView(ComponentSettingsView.ID);
    if (view != null) {
      ComponentSettingsView compSettings=(ComponentSettingsView)view;
      compSettings.cleanDisplay();
    }
  }
}

Fixed version (ground truth):
@Override public void setSelected(final int value){
  super.setSelected(value);
  List cl=this.getChildren();
  for (int i=0; i < cl.size(); i++) {
    if (((EditPart)cl.get(i)).getSelected() != value) {
      ((EditPart)cl.get(i)).setSelected(value);
    }
  }
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  if (value == SELECTED_PRIMARY) {
    IViewPart view=page.findView(ComponentSettingsView.ID);
    if (view != null) {
      ComponentSettingsView compSettings=(ComponentSettingsView)view;
      compSettings.setElement((Connection)getModel());
      CodeView.refreshCodeView((Connection)getModel());
    }
  }
 else   if (value == SELECTED_NONE) {
    IViewPart view=page.findView(ComponentSettingsView.ID);
    if (view != null) {
      ComponentSettingsView compSettings=(ComponentSettingsView)view;
      compSettings.cleanDisplay();
    }
  }
}
Program: 120708
Project: 120708
Buggy source:
public void activate(){
  if (!isActive()) {
    super.activate();
    ((Element)getModel()).addPropertyChangeListener(this);
  }
}

Fixed version (ground truth):
@Override public void activate(){
  if (!isActive()) {
    super.activate();
    ((Element)getModel()).addPropertyChangeListener(this);
  }
}
Program: 120709
Project: 120709
Buggy source:
protected void createEditPolicies(){
  installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,new ConnectionEndpointEditPolicy());
  installEditPolicy(EditPolicy.CONNECTION_ROLE,new ConnectionEditPolicy(){
    protected Command getDeleteCommand(    GroupRequest request){
      if (((Connection)getModel()).isReadOnly()) {
        return null;
      }
      List<Connection> connectionList=new ArrayList<Connection>();
      for (int i=0; i < request.getEditParts().size(); i++) {
        if (request.getEditParts().get(i) instanceof ConnectionPart) {
          connectionList.add(((Connection)((ConnectionPart)request.getEditParts().get(i)).getModel()));
        }
      }
      return new ConnectionDeleteCommand(connectionList);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void createEditPolicies(){
  installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,new ConnectionEndpointEditPolicy());
  installEditPolicy(EditPolicy.CONNECTION_ROLE,new ConnectionEditPolicy(){
    @Override protected Command getDeleteCommand(    GroupRequest request){
      if (((Connection)getModel()).isReadOnly()) {
        return null;
      }
      List<Connection> connectionList=new ArrayList<Connection>();
      for (int i=0; i < request.getEditParts().size(); i++) {
        if (request.getEditParts().get(i) instanceof ConnectionPart) {
          connectionList.add(((Connection)((ConnectionPart)request.getEditParts().get(i)).getModel()));
        }
      }
      return new ConnectionDeleteCommand(connectionList);
    }
  }
);
}
Program: 120710
Project: 120710
Buggy source:
public void propertyChange(final PropertyChangeEvent event){
  String property=event.getPropertyName();
  ConnectionFigure connectionFigure=(ConnectionFigure)figure;
  if (Connection.LINESTYLE_PROP.equals(property)) {
    connectionFigure.setConnectionProperty(((Connection)getModel()).getSourceNodeConnector().getConnectionProperty(((Connection)getModel()).getLineStyle()));
    refreshChildren();
  }
  if (Connection.NAME.equals(property)) {
    refreshChildren();
  }
  if (EParameterName.MONITOR_CONNECTION.getName().equals(property)) {
    connectionFigure.repaint();
    refreshChildren();
  }
  if (EParameterName.NONE.getName().equals(property) || EParameterName.PARTITIONER.getName().equals(property) || EParameterName.DEPARTITIONER.getName().equals(property)|| EParameterName.REPARTITIONER.getName().equals(property)) {
    connectionFigure.updateStatus();
    connectionFigure.repaint();
    refreshChildren();
  }
  if (property.equals(EParameterName.ACTIVATE.getName())) {
    if (((Connection)getModel()).isActivate()) {
      connectionFigure.setAlpha(-1);
      connectionFigure.repaint();
      refreshVisuals();
    }
 else {
      connectionFigure.setAlpha(Connection.ALPHA_VALUE);
      connectionFigure.repaint();
      refreshVisuals();
    }
  }
}

Fixed version (ground truth):
@Override public void propertyChange(final PropertyChangeEvent event){
  String property=event.getPropertyName();
  ConnectionFigure connectionFigure=(ConnectionFigure)figure;
  if (Connection.LINESTYLE_PROP.equals(property)) {
    connectionFigure.setConnectionProperty(((Connection)getModel()).getSourceNodeConnector().getConnectionProperty(((Connection)getModel()).getLineStyle()));
    refreshChildren();
  }
  if (Connection.NAME.equals(property)) {
    refreshChildren();
  }
  if (EParameterName.MONITOR_CONNECTION.getName().equals(property)) {
    connectionFigure.repaint();
    refreshChildren();
  }
  if (EParameterName.NONE.getName().equals(property) || EParameterName.PARTITIONER.getName().equals(property) || EParameterName.DEPARTITIONER.getName().equals(property)|| EParameterName.REPARTITIONER.getName().equals(property)) {
    connectionFigure.updateStatus();
    connectionFigure.repaint();
    refreshChildren();
  }
  if (property.equals(EParameterName.ACTIVATE.getName())) {
    if (((Connection)getModel()).isActivate()) {
      connectionFigure.setAlpha(-1);
      connectionFigure.repaint();
      refreshVisuals();
    }
 else {
      connectionFigure.setAlpha(Connection.ALPHA_VALUE);
      connectionFigure.repaint();
      refreshVisuals();
    }
  }
}
Program: 120711
Project: 120711
Buggy source:
protected Command getDeleteCommand(GroupRequest request){
  if (((Connection)getModel()).isReadOnly()) {
    return null;
  }
  List<Connection> connectionList=new ArrayList<Connection>();
  for (int i=0; i < request.getEditParts().size(); i++) {
    if (request.getEditParts().get(i) instanceof ConnectionPart) {
      connectionList.add(((Connection)((ConnectionPart)request.getEditParts().get(i)).getModel()));
    }
  }
  return new ConnectionDeleteCommand(connectionList);
}

Fixed version (ground truth):
@Override protected Command getDeleteCommand(GroupRequest request){
  if (((Connection)getModel()).isReadOnly()) {
    return null;
  }
  List<Connection> connectionList=new ArrayList<Connection>();
  for (int i=0; i < request.getEditParts().size(); i++) {
    if (request.getEditParts().get(i) instanceof ConnectionPart) {
      connectionList.add(((Connection)((ConnectionPart)request.getEditParts().get(i)).getModel()));
    }
  }
  return new ConnectionDeleteCommand(connectionList);
}
Program: 120712
Project: 120712
Buggy source:
protected IFigure createFigure(){
  IConnection conn=(IConnection)getModel();
  ConnectionFigure connection=new ConnectionFigure(conn,conn.getSourceNodeConnector().getConnectionProperty(conn.getLineStyle()),conn.getSource());
  if (((Connection)getModel()).isActivate()) {
    ((ConnectionFigure)connection).setAlpha(-1);
  }
 else {
    ((ConnectionFigure)connection).setAlpha(Connection.ALPHA_VALUE);
  }
  if (PluginChecker.isAutoParalelPluginLoaded()) {
    connection.updateStatus();
  }
  return connection;
}

Fixed version (ground truth):
@Override protected IFigure createFigure(){
  IConnection conn=(IConnection)getModel();
  ConnectionFigure connection=new ConnectionFigure(conn,conn.getSourceNodeConnector().getConnectionProperty(conn.getLineStyle()),conn.getSource());
  if (((Connection)getModel()).isActivate()) {
    connection.setAlpha(-1);
  }
 else {
    connection.setAlpha(Connection.ALPHA_VALUE);
  }
  if (PluginChecker.isAutoParalelPluginLoaded()) {
    connection.updateStatus();
  }
  return connection;
}
Program: 120713
Project: 120713
Buggy source:
public void deactivate(){
  if (isActive()) {
    super.deactivate();
    ((Element)getModel()).removePropertyChangeListener(this);
  }
}

Fixed version (ground truth):
@Override public void deactivate(){
  if (isActive()) {
    super.deactivate();
    ((Element)getModel()).removePropertyChangeListener(this);
  }
}
Program: 120714
Project: 120714
Buggy source:
@Override public Process run(int statisticsPort,int tracePort,String watchParam,IProgressMonitor monitor,IProcessMessageManager processMessageManager) throws ProcessorException {
  ExportProcessorHelper helper=new ExportProcessorHelper();
  String archive=helper.exportJob(this,statisticsPort,tracePort,watchParam,monitor);
  unzipFolder=unzipAndDeploy(process,archive);
  Process process=super.execFrom(unzipFolder + File.separatorChar + this.process.getName(),Level.INFO,statisticsPort,tracePort,new String[]{watchParam});
  return process;
}

Fixed version (ground truth):
@Override public Process run(int statisticsPort,int tracePort,String watchParam,IProgressMonitor monitor,IProcessMessageManager processMessageManager) throws ProcessorException {
  return run(new String[]{watchParam},statisticsPort,tracePort,monitor,processMessageManager);
}
Program: 120717
Project: 120717
Buggy source:
protected List getModelChildren(){
  List<Element> elements;
  elements=new ArrayList<Element>();
  elements.add(((Connection)getModel()).getConnectionLabel());
  elements.add(((Connection)getModel()).getPerformance());
  if (((Connection)getModel()).getResuming() != null) {
    elements.add(((Connection)getModel()).getResuming());
  }
  if (((Connection)getModel()).getConnectionTrace() != null) {
    elements.add(((Connection)getModel()).getConnectionTrace());
  }
  if (((Connection)getModel()).isMonitorConnection()) {
    elements.add(((Connection)getModel()).getMonitorLabel());
  }
  return elements;
}

Fixed version (ground truth):
@Override protected List getModelChildren(){
  List<Element> elements;
  elements=new ArrayList<Element>();
  elements.add(((Connection)getModel()).getConnectionLabel());
  elements.add(((Connection)getModel()).getPerformance());
  EditPart contents=getRoot().getContents();
  boolean monitorSupport=true;
  if (contents.getModel() instanceof IProcess) {
    IProcess currentProcess=(IProcess)contents.getModel();
    if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().endsWith(currentProcess.getComponentsType())) {
      monitorSupport=false;
    }
  }
  if (monitorSupport) {
    if (((Connection)getModel()).getResuming() != null) {
      elements.add(((Connection)getModel()).getResuming());
    }
    if (((Connection)getModel()).getConnectionTrace() != null) {
      elements.add(((Connection)getModel()).getConnectionTrace());
    }
    if (((Connection)getModel()).isMonitorConnection()) {
      elements.add(((Connection)getModel()).getMonitorLabel());
    }
  }
  return elements;
}
Program: 120718
Project: 120718
Buggy source:
public void setSelected(final int value){
  super.setSelected(value);
  List cl=this.getChildren();
  for (int i=0; i < cl.size(); i++) {
    if (((EditPart)cl.get(i)).getSelected() != value) {
      ((EditPart)cl.get(i)).setSelected(value);
    }
  }
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  if (value == SELECTED_PRIMARY) {
    IViewPart view=page.findView(ComponentSettingsView.ID);
    if (view != null) {
      ComponentSettingsView compSettings=(ComponentSettingsView)view;
      compSettings.setElement((Connection)getModel());
      CodeView.refreshCodeView((Connection)getModel());
    }
  }
 else   if (value == SELECTED_NONE) {
    IViewPart view=page.findView(ComponentSettingsView.ID);
    if (view != null) {
      ComponentSettingsView compSettings=(ComponentSettingsView)view;
      compSettings.cleanDisplay();
    }
  }
}

Fixed version (ground truth):
@Override public void setSelected(final int value){
  super.setSelected(value);
  List cl=this.getChildren();
  for (int i=0; i < cl.size(); i++) {
    if (((EditPart)cl.get(i)).getSelected() != value) {
      ((EditPart)cl.get(i)).setSelected(value);
    }
  }
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  if (value == SELECTED_PRIMARY) {
    IViewPart view=page.findView(ComponentSettingsView.ID);
    if (view != null) {
      ComponentSettingsView compSettings=(ComponentSettingsView)view;
      compSettings.setElement((Connection)getModel());
      CodeView.refreshCodeView((Connection)getModel());
    }
  }
 else   if (value == SELECTED_NONE) {
    IViewPart view=page.findView(ComponentSettingsView.ID);
    if (view != null) {
      ComponentSettingsView compSettings=(ComponentSettingsView)view;
      compSettings.cleanDisplay();
    }
  }
}
Program: 120719
Project: 120719
Buggy source:
public void activate(){
  if (!isActive()) {
    super.activate();
    ((Element)getModel()).addPropertyChangeListener(this);
  }
}

Fixed version (ground truth):
@Override public void activate(){
  if (!isActive()) {
    super.activate();
    ((Element)getModel()).addPropertyChangeListener(this);
  }
}
Program: 120720
Project: 120720
Buggy source:
protected void createEditPolicies(){
  installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,new ConnectionEndpointEditPolicy());
  installEditPolicy(EditPolicy.CONNECTION_ROLE,new ConnectionEditPolicy(){
    protected Command getDeleteCommand(    GroupRequest request){
      if (((Connection)getModel()).isReadOnly()) {
        return null;
      }
      List<Connection> connectionList=new ArrayList<Connection>();
      for (int i=0; i < request.getEditParts().size(); i++) {
        if (request.getEditParts().get(i) instanceof ConnectionPart) {
          connectionList.add(((Connection)((ConnectionPart)request.getEditParts().get(i)).getModel()));
        }
      }
      return new ConnectionDeleteCommand(connectionList);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void createEditPolicies(){
  installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,new ConnectionEndpointEditPolicy());
  installEditPolicy(EditPolicy.CONNECTION_ROLE,new ConnectionEditPolicy(){
    @Override protected Command getDeleteCommand(    GroupRequest request){
      if (((Connection)getModel()).isReadOnly()) {
        return null;
      }
      List<Connection> connectionList=new ArrayList<Connection>();
      for (int i=0; i < request.getEditParts().size(); i++) {
        if (request.getEditParts().get(i) instanceof ConnectionPart) {
          connectionList.add(((Connection)((ConnectionPart)request.getEditParts().get(i)).getModel()));
        }
      }
      return new ConnectionDeleteCommand(connectionList);
    }
  }
);
}
Program: 120721
Project: 120721
Buggy source:
public void propertyChange(final PropertyChangeEvent event){
  String property=event.getPropertyName();
  ConnectionFigure connectionFigure=(ConnectionFigure)figure;
  if (Connection.LINESTYLE_PROP.equals(property)) {
    connectionFigure.setConnectionProperty(((Connection)getModel()).getSourceNodeConnector().getConnectionProperty(((Connection)getModel()).getLineStyle()));
    refreshChildren();
  }
  if (Connection.NAME.equals(property)) {
    refreshChildren();
  }
  if (EParameterName.MONITOR_CONNECTION.getName().equals(property)) {
    connectionFigure.repaint();
    refreshChildren();
  }
  if (EParameterName.NONE.getName().equals(property) || EParameterName.PARTITIONER.getName().equals(property) || EParameterName.DEPARTITIONER.getName().equals(property)|| EParameterName.REPARTITIONER.getName().equals(property)) {
    connectionFigure.updateStatus();
    connectionFigure.repaint();
    refreshChildren();
  }
  if (property.equals(EParameterName.ACTIVATE.getName())) {
    if (((Connection)getModel()).isActivate()) {
      connectionFigure.setAlpha(-1);
      connectionFigure.repaint();
      refreshVisuals();
    }
 else {
      connectionFigure.setAlpha(Connection.ALPHA_VALUE);
      connectionFigure.repaint();
      refreshVisuals();
    }
  }
}

Fixed version (ground truth):
@Override public void propertyChange(final PropertyChangeEvent event){
  String property=event.getPropertyName();
  ConnectionFigure connectionFigure=(ConnectionFigure)figure;
  if (Connection.LINESTYLE_PROP.equals(property)) {
    connectionFigure.setConnectionProperty(((Connection)getModel()).getSourceNodeConnector().getConnectionProperty(((Connection)getModel()).getLineStyle()));
    refreshChildren();
  }
  if (Connection.NAME.equals(property)) {
    refreshChildren();
  }
  if (EParameterName.MONITOR_CONNECTION.getName().equals(property)) {
    connectionFigure.repaint();
    refreshChildren();
  }
  if (EParameterName.NONE.getName().equals(property) || EParameterName.PARTITIONER.getName().equals(property) || EParameterName.DEPARTITIONER.getName().equals(property)|| EParameterName.REPARTITIONER.getName().equals(property)) {
    connectionFigure.updateStatus();
    connectionFigure.repaint();
    refreshChildren();
  }
  if (property.equals(EParameterName.ACTIVATE.getName())) {
    if (((Connection)getModel()).isActivate()) {
      connectionFigure.setAlpha(-1);
      connectionFigure.repaint();
      refreshVisuals();
    }
 else {
      connectionFigure.setAlpha(Connection.ALPHA_VALUE);
      connectionFigure.repaint();
      refreshVisuals();
    }
  }
}
Program: 120722
Project: 120722
Buggy source:
protected Command getDeleteCommand(GroupRequest request){
  if (((Connection)getModel()).isReadOnly()) {
    return null;
  }
  List<Connection> connectionList=new ArrayList<Connection>();
  for (int i=0; i < request.getEditParts().size(); i++) {
    if (request.getEditParts().get(i) instanceof ConnectionPart) {
      connectionList.add(((Connection)((ConnectionPart)request.getEditParts().get(i)).getModel()));
    }
  }
  return new ConnectionDeleteCommand(connectionList);
}

Fixed version (ground truth):
@Override protected Command getDeleteCommand(GroupRequest request){
  if (((Connection)getModel()).isReadOnly()) {
    return null;
  }
  List<Connection> connectionList=new ArrayList<Connection>();
  for (int i=0; i < request.getEditParts().size(); i++) {
    if (request.getEditParts().get(i) instanceof ConnectionPart) {
      connectionList.add(((Connection)((ConnectionPart)request.getEditParts().get(i)).getModel()));
    }
  }
  return new ConnectionDeleteCommand(connectionList);
}
Program: 120723
Project: 120723
Buggy source:
protected IFigure createFigure(){
  IConnection conn=(IConnection)getModel();
  ConnectionFigure connection=new ConnectionFigure(conn,conn.getSourceNodeConnector().getConnectionProperty(conn.getLineStyle()),conn.getSource());
  if (((Connection)getModel()).isActivate()) {
    ((ConnectionFigure)connection).setAlpha(-1);
  }
 else {
    ((ConnectionFigure)connection).setAlpha(Connection.ALPHA_VALUE);
  }
  if (PluginChecker.isAutoParalelPluginLoaded()) {
    connection.updateStatus();
  }
  return connection;
}

Fixed version (ground truth):
@Override protected IFigure createFigure(){
  IConnection conn=(IConnection)getModel();
  ConnectionFigure connection=new ConnectionFigure(conn,conn.getSourceNodeConnector().getConnectionProperty(conn.getLineStyle()),conn.getSource());
  if (((Connection)getModel()).isActivate()) {
    connection.setAlpha(-1);
  }
 else {
    connection.setAlpha(Connection.ALPHA_VALUE);
  }
  if (PluginChecker.isAutoParalelPluginLoaded()) {
    connection.updateStatus();
  }
  return connection;
}
Program: 120724
Project: 120724
Buggy source:
public void deactivate(){
  if (isActive()) {
    super.deactivate();
    ((Element)getModel()).removePropertyChangeListener(this);
  }
}

Fixed version (ground truth):
@Override public void deactivate(){
  if (isActive()) {
    super.deactivate();
    ((Element)getModel()).removePropertyChangeListener(this);
  }
}
Program: 120725
Project: 120725
Buggy source:
protected void addFontAndColorFieldsForDataViewer(Composite composite){
  IntegerFieldEditor rowLimit=new IntegerFieldEditor(IComponentPreferenceConstant.LIMIT,Messages.getString("String_Node_Str"),composite);
  addField(rowLimit);
  Text textControl=rowLimit.getTextControl(composite);
  GridData layoutData=new GridData();
  layoutData.widthHint=200;
  textControl.setLayoutData(layoutData);
}

Fixed version (ground truth):
protected void addFontAndColorFieldsForDataViewer(Composite composite){
  IntegerFieldEditor rowLimit=new IntegerFieldEditor(IComponentPreferenceConstant.LIMIT,Messages.getString("String_Node_Str"),composite);
  rowLimit.setValidRange(1,1000);
  addField(rowLimit);
  Text textControl=rowLimit.getTextControl(composite);
  GridData layoutData=new GridData();
  layoutData.widthHint=200;
  textControl.setLayoutData(layoutData);
}
Program: 120726
Project: 120726
Buggy source:
public static Job initialize(){
  Job job=new Job(Messages.getString("String_Node_Str")){
    @Override protected IStatus run(    IProgressMonitor monitor){
synchronized (delegateMonitor) {
        if (jobRunnable == null) {
          jobRunnable=new JobRunnable(Messages.getString("String_Node_Str"));
          jobRunnable.start();
        }
      }
      delegateMonitor.addDelegate(monitor);
      while (jobRunnable != null && jobRunnable.isAlive()) {
        try {
          Thread.sleep(500);
        }
 catch (        InterruptedException e) {
        }
      }
      delegateMonitor.clearDelegate();
synchronized (delegateMonitor) {
        jobRunnable=null;
      }
      return status;
    }
  }
;
  job.setUser(false);
  job.setPriority(Job.INTERACTIVE);
  job.schedule();
  job.wakeUp();
  return job;
}

Fixed version (ground truth):
public static Job initialize(){
  Job job=new Job(Messages.getString("String_Node_Str")){
    @Override protected IStatus run(    IProgressMonitor monitor){
synchronized (delegateMonitor) {
        if (jobRunnable == null) {
          jobRunnable=new JobRunnable(Messages.getString("String_Node_Str"));
          jobRunnable.start();
        }
      }
      delegateMonitor.addDelegate(monitor);
      while (jobRunnable != null && jobRunnable.isAlive()) {
        try {
          Thread.sleep(500);
        }
 catch (        InterruptedException e) {
        }
      }
      delegateMonitor.clearDelegate();
synchronized (delegateMonitor) {
        jobRunnable=null;
      }
      return status;
    }
  }
;
  job.setUser(false);
  job.setSystem(true);
  job.setPriority(Job.INTERACTIVE);
  job.schedule();
  job.wakeUp();
  return job;
}
Program: 120734
Project: 120734
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: 120735
Project: 120735
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;
}