nus-yam/ex-repair huggingface dataset:
Program: 122889
Project: 122889
Buggy source:
public Point getReferencePoint(){
  Point ref=null;
  final VarTableEditPart varTablePart=(VarTableEditPart)varNodePart.getParent();
  if (((VarTable)varTablePart.getModel()).isMinimized()) {
    if (isSource) {
      ref=varTablePart.getFigure().getBounds().getRight();
    }
 else {
      ref=varTablePart.getFigure().getBounds().getLeft();
    }
  }
 else   if (getOwner() instanceof TreeNodeFigure) {
    TreeNodeFigure nodeFigure=(TreeNodeFigure)getOwner();
    if (nodeFigure.getTreeBranch() == null) {
      if (isSource) {
        ref=getOwner().getBounds().getRight();
      }
 else {
        if (nodeFigure.getElement() != null) {
          ref=nodeFigure.getElement().getBounds().getLeft();
        }
 else {
          ref=getOwner().getBounds().getLeft();
        }
      }
      getOwner().translateToAbsolute(ref);
    }
  }
 else   if (getOwner() instanceof VarNodeFigure) {
    VarNodeFigure varNodeFigure=(VarNodeFigure)getOwner();
    if (isSource) {
      ref=getOwner().getBounds().getRight();
    }
 else {
      if (varNodeFigure.getExpression() != null) {
        ref=varNodeFigure.getExpression().getBounds().getLeft();
      }
 else {
        ref=getOwner().getBounds().getLeft();
      }
    }
    getOwner().translateToAbsolute(ref);
  }
 else {
    ref=getOwner().getBounds().getCenter();
    getOwner().translateToAbsolute(ref);
  }
  return ref;
}

Fixed version (ground truth):
@Override public Point getReferencePoint(){
  Point ref=null;
  final VarTableEditPart varTablePart=(VarTableEditPart)varNodePart.getParent();
  if (((VarTable)varTablePart.getModel()).isMinimized()) {
    if (isSource) {
      ref=varTablePart.getFigure().getBounds().getRight();
    }
 else {
      ref=varTablePart.getFigure().getBounds().getLeft();
    }
  }
 else   if (getOwner() instanceof TreeNodeFigure) {
    TreeNodeFigure nodeFigure=(TreeNodeFigure)getOwner();
    if (nodeFigure.getTreeBranch() == null) {
      if (isSource) {
        ref=getOwner().getBounds().getRight();
      }
 else {
        if (nodeFigure.getElement() != null) {
          ref=nodeFigure.getElement().getBounds().getLeft();
        }
 else {
          ref=getOwner().getBounds().getLeft();
        }
      }
      getOwner().translateToAbsolute(ref);
    }
  }
 else   if (getOwner() instanceof VarNodeFigure) {
    VarNodeFigure varNodeFigure=(VarNodeFigure)getOwner();
    if (isSource) {
      ref=getOwner().getBounds().getRight();
    }
 else {
      if (varNodeFigure.getExpression() != null) {
        ref=varNodeFigure.getExpression().getBounds().getLeft();
      }
 else {
        ref=getOwner().getBounds().getLeft();
      }
    }
    getOwner().translateToAbsolute(ref);
  }
 else {
    ref=getOwner().getBounds().getCenter();
    getOwner().translateToAbsolute(ref);
  }
  return ref;
}
Program: 122890
Project: 122890
Buggy source:
public ConnectionAnchor getSourceConnectionAnchor(Request request){
  IFigure figure=null;
  figure=getFigure();
  return new ColumnAnchor(this,figure,true);
}

Fixed version (ground truth):
@Override public ConnectionAnchor getSourceConnectionAnchor(Request request){
  return new ColumnAnchor(this,getFigure(),true);
}
Program: 122892
Project: 122892
Buggy source:
@Override public void performRequest(Request req){
  if (req instanceof SelectionRequest) {
    Point location=((SelectionRequest)req).getLocation();
    List<NodeContainer> list=this.getModelChildren();
    for (    NodeContainer nodeCon : list) {
      if (nodeCon.getErrorMarkRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        if (node.isErrorFlag()) {
          Shell shell=Display.getCurrent().getActiveShell();
          ErrorMessageDialog dialog=new ErrorMessageDialog(new Shell(shell),node);
          dialog.open();
          break;
        }
      }
 else       if (nodeCon.getErrorRectangle() != null && nodeCon.getErrorRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        showModules(node);
      }
    }
  }
  super.performRequest(req);
}

Fixed version (ground truth):
@Override public void performRequest(Request req){
  if (req instanceof SelectionRequest) {
    Point location=((SelectionRequest)req).getLocation();
    List<NodeContainer> list=this.getModelChildren();
    for (    NodeContainer nodeCon : list) {
      if (nodeCon.getErrorMarkRectangle() != null && nodeCon.getErrorMarkRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        if (node.isErrorFlag()) {
          Shell shell=Display.getCurrent().getActiveShell();
          ErrorMessageDialog dialog=new ErrorMessageDialog(new Shell(shell),node);
          dialog.open();
          break;
        }
      }
 else       if (nodeCon.getErrorRectangle() != null && nodeCon.getErrorRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        showModules(node);
      }
    }
  }
  super.performRequest(req);
}
Program: 122893
Project: 122893
Buggy source:
public ConnectionAnchor getTargetConnectionAnchor(Request request){
  return new ChopboxAnchor(getFigure());
}

Fixed version (ground truth):
@Override public ConnectionAnchor getTargetConnectionAnchor(Request request){
  return new ChopboxAnchor(getFigure());
}
Program: 122894
Project: 122894
Buggy source:
public void propertyChange(PropertyChangeEvent evt){
  String prop=evt.getPropertyName();
  if (SubjobContainer.UPDATE_SUBJOB_CONTENT.equals(prop)) {
    refresh();
    List<AbstractGraphicalEditPart> childrens=getChildren();
    for (    AbstractGraphicalEditPart part : childrens) {
      part.refresh();
    }
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_CONNECTIONS.equals(prop)) {
    refreshSourceConnections();
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_TITLE_COLOR.equals(prop)) {
    if (getFigure() instanceof SubjobContainerFigure) {
      ((SubjobContainerFigure)getFigure()).updateSubJobTitleColor();
      refreshVisuals();
    }
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_DISPLAY.equals(prop)) {
    List<NodeContainer> tmpList=new ArrayList<NodeContainer>(((SubjobContainer)getModel()).getNodeContainers());
    ((SubjobContainer)getModel()).getNodeContainers().clear();
    refreshChildren();
    List elems=((Process)getParent().getModel()).getElements();
    elems.remove(getModel());
    EditPart parent=getParent();
    parent.refresh();
    ((SubjobContainer)getModel()).getNodeContainers().addAll(tmpList);
    elems.add(getModel());
    parent.refresh();
  }
 else {
    if (getFigure() instanceof SubjobContainerFigure) {
      ((SubjobContainerFigure)getFigure()).updateData();
      refreshVisuals();
    }
  }
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent evt){
  String prop=evt.getPropertyName();
  if (SubjobContainer.UPDATE_SUBJOB_CONTENT.equals(prop)) {
    refresh();
    List<AbstractGraphicalEditPart> childrens=getChildren();
    for (    AbstractGraphicalEditPart part : childrens) {
      part.refresh();
    }
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_CONNECTIONS.equals(prop)) {
    refreshSourceConnections();
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_TITLE_COLOR.equals(prop)) {
    if (getFigure() instanceof SubjobContainerFigure) {
      ((SubjobContainerFigure)getFigure()).updateSubJobTitleColor();
      refreshVisuals();
    }
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_DISPLAY.equals(prop)) {
    List<NodeContainer> tmpList=new ArrayList<NodeContainer>(((SubjobContainer)getModel()).getNodeContainers());
    ((SubjobContainer)getModel()).getNodeContainers().clear();
    refreshChildren();
    List elems=((Process)getParent().getModel()).getElements();
    elems.remove(getModel());
    EditPart parent=getParent();
    parent.refresh();
    ((SubjobContainer)getModel()).getNodeContainers().addAll(tmpList);
    elems.add(getModel());
    parent.refresh();
  }
 else {
    if (getFigure() instanceof SubjobContainerFigure) {
      ((SubjobContainerFigure)getFigure()).updateData();
      refreshVisuals();
    }
  }
}
Program: 122895
Project: 122895
Buggy source:
public ConnectionAnchor getSourceConnectionAnchor(Request request){
  return new ChopboxAnchor(getFigure());
}

Fixed version (ground truth):
@Override public ConnectionAnchor getSourceConnectionAnchor(Request request){
  return new ChopboxAnchor(getFigure());
}
Program: 122896
Project: 122896
Buggy source:
@Override public void performRequest(Request req){
  if (req instanceof SelectionRequest) {
    Point location=((SelectionRequest)req).getLocation();
    List<NodeContainer> list=this.getModelChildren();
    for (    NodeContainer nodeCon : list) {
      if (nodeCon.getErrorMarkRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        if (node.isErrorFlag()) {
          Shell shell=Display.getCurrent().getActiveShell();
          ErrorMessageDialog dialog=new ErrorMessageDialog(new Shell(shell),node);
          dialog.open();
          break;
        }
      }
 else       if (nodeCon.getErrorRectangle() != null && nodeCon.getErrorRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        showModules(node);
      }
    }
  }
  super.performRequest(req);
}

Fixed version (ground truth):
@Override public void performRequest(Request req){
  if (req instanceof SelectionRequest) {
    Point location=((SelectionRequest)req).getLocation();
    List<NodeContainer> list=this.getModelChildren();
    for (    NodeContainer nodeCon : list) {
      if (nodeCon.getErrorMarkRectangle() != null && nodeCon.getErrorMarkRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        if (node.isErrorFlag()) {
          Shell shell=Display.getCurrent().getActiveShell();
          ErrorMessageDialog dialog=new ErrorMessageDialog(new Shell(shell),node);
          dialog.open();
          break;
        }
      }
 else       if (nodeCon.getErrorRectangle() != null && nodeCon.getErrorRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        showModules(node);
      }
    }
  }
  super.performRequest(req);
}
Program: 122897
Project: 122897
Buggy source:
/** 
 * DOC amaumont Comment method "saveDataBeforeClose".
 * @param response
 */
public void prepareClosing(int response){
  setMapperResponse(response);
  if (response == SWT.CANCEL) {
    removeUnsavedOutputsFromProcess();
  }
 else {
    mapperManager.getAbstractMapComponent().restoreMapperModelFromInternalData();
  }
  saveCurrentUIProperties();
  if (response == SWT.OK || response == SWT.APPLICATION_MODAL) {
    createVisualMapImage();
    closeWithoutPrompt=true;
    Map<IConnection,Set<String>> preColumnSets=mapperUI.getPreColumnSet();
    List<InputTable> inputTables=mapperManager.getInputTables();
    List<OutputTable> outputTables=mapperManager.getOutputTables();
    setTraceFilterParaMapper(preColumnSets,inputTables,changedNameColumns);
    setTraceFilterParaMapper(preColumnSets,outputTables,changedNameColumns);
    refreshVisualMapImage();
  }
  mapperManager.updateEmfParameters(EParameterName.PREVIEW.getName());
}

Fixed version (ground truth):
/** 
 * DOC amaumont Comment method "saveDataBeforeClose".
 * @param response
 */
public void prepareClosing(int response){
  if (response == SWT.OK || response == SWT.APPLICATION_MODAL) {
    setMapperResponse(SWT.OK);
  }
  if (response == SWT.CANCEL) {
    removeUnsavedOutputsFromProcess();
  }
 else {
    mapperManager.getAbstractMapComponent().restoreMapperModelFromInternalData();
  }
  saveCurrentUIProperties();
  if (response == SWT.OK || response == SWT.APPLICATION_MODAL) {
    createVisualMapImage();
    closeWithoutPrompt=true;
    Map<IConnection,Set<String>> preColumnSets=mapperUI.getPreColumnSet();
    List<InputTable> inputTables=mapperManager.getInputTables();
    List<OutputTable> outputTables=mapperManager.getOutputTables();
    setTraceFilterParaMapper(preColumnSets,inputTables,changedNameColumns);
    setTraceFilterParaMapper(preColumnSets,outputTables,changedNameColumns);
    refreshVisualMapImage();
  }
  mapperManager.updateEmfParameters(EParameterName.PREVIEW.getName());
}
Program: 122900
Project: 122900
Buggy source:
/** 
 * DOC amaumont Comment method "addListenersToInputButtons".
 */
private void addListenersToInputButtons(){
  MetadataToolbarEditorView toolBar=inputMetaEditor.getToolBar();
  inputToolBarButtons=toolBar.getButtons();
  beforeCommandListenerForInputButtons=new IExtendedButtonListener(){
    public void handleEvent(    ExtendedButtonEvent event){
    }
  }
;
  for (  ExtendedPushButton extendedPushButton : inputToolBarButtons) {
    extendedPushButton.addListener(beforeCommandListenerForInputButtons,true);
  }
  this.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      for (      ExtendedPushButton extendedPushButton : inputToolBarButtons) {
        extendedPushButton.removeListener(beforeCommandListenerForInputButtons,true);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * DOC amaumont Comment method "addListenersToInputButtons".
 */
private void addListenersToInputButtons(){
  MetadataToolbarEditorView toolBar=inputMetaEditor.getToolBar();
  inputToolBarButtons=toolBar.getButtons();
  beforeCommandListenerForInputButtons=new IExtendedButtonListener(){
    @Override public void handleEvent(    ExtendedButtonEvent event){
    }
  }
;
  for (  ExtendedPushButton extendedPushButton : inputToolBarButtons) {
    extendedPushButton.addListener(beforeCommandListenerForInputButtons,true);
  }
  this.addDisposeListener(new DisposeListener(){
    @Override public void widgetDisposed(    DisposeEvent e){
      for (      ExtendedPushButton extendedPushButton : inputToolBarButtons) {
        extendedPushButton.removeListener(beforeCommandListenerForInputButtons,true);
      }
    }
  }
);
}
Program: 122901
Project: 122901
Buggy source:
public void handleEvent(ExtendedButtonEvent event){
}

Fixed version (ground truth):
@Override public void handleEvent(ExtendedButtonEvent event){
}
Program: 122902
Project: 122902
Buggy source:
public void handle(LineSelectionEvent e){
  for (  TableItem item : tableViewerCreator.getTable().getSelection()) {
    if (item.getData() instanceof MetadataColumn) {
      MetadataColumn column=(MetadataColumn)item.getData();
      removeButton.getButton().setEnabled(!column.isCustom());
      break;
    }
  }
}

Fixed version (ground truth):
@Override public void handle(LineSelectionEvent e){
  for (  TableItem item : tableViewerCreator.getTable().getSelection()) {
    if (item.getData() instanceof MetadataColumn) {
      MetadataColumn column=(MetadataColumn)item.getData();
      removeButton.getButton().setEnabled(!column.isCustom());
      break;
    }
  }
}
Program: 122905
Project: 122905
Buggy source:
public void widgetDisposed(DisposeEvent e){
  for (  ExtendedPushButton extendedPushButton : outputToolBarButtons) {
    extendedPushButton.removeListener(beforeCommandListenerForOutputButtons,true);
  }
}

Fixed version (ground truth):
@Override public void widgetDisposed(DisposeEvent e){
  for (  ExtendedPushButton extendedPushButton : outputToolBarButtons) {
    extendedPushButton.removeListener(beforeCommandListenerForOutputButtons,true);
  }
}
Program: 122906
Project: 122906
Buggy source:
protected String validateXPath(String newValue,int beanPosition){
  if (beanPosition == -1) {
    return null;
  }
  isValidName=true;
  if (newValue == null || "String_Node_Str".equals(newValue)) {
    isValidName=false;
    return "String_Node_Str";
  }
  final String validateNameSpace=validateNameSpace(newValue);
  if (validateNameSpace != null) {
    return validateNameSpace;
  }
  TreeSchemaTableEntry bean=getExtendedTableModel().getBeansList().get(beanPosition);
  if (getExtendedTableModel() != null) {
    for (int i=0; i < getExtendedTableModel().getBeansList().size(); i++) {
      if (i == beanPosition) {
        continue;
      }
      TreeSchemaTableEntry entry=getExtendedTableModel().getBeansList().get(i);
      if (bean.getXPath().equals(entry.getXPath())) {
        isValidName=false;
        return "String_Node_Str";
      }
    }
  }
  return null;
}

Fixed version (ground truth):
protected String validateXPath(String newValue,int beanPosition){
  if (beanPosition == -1) {
    return null;
  }
  isValidName=true;
  if (newValue == null || "String_Node_Str".equals(newValue)) {
    isValidName=false;
    return "String_Node_Str";
  }
  TreeSchemaTableEntry bean=getExtendedTableModel().getBeansList().get(beanPosition);
  if (NodeType.NAME_SPACE == bean.getTreeNode().getNodeType()) {
    final String validateNameSpace=validateNameSpace(newValue,beanPosition);
    if (validateNameSpace != null) {
      return validateNameSpace;
    }
  }
  if (!StringUtil.validateLabelForXML(newValue)) {
    if (NodeType.ELEMENT == bean.getTreeNode().getNodeType()) {
      isValidName=false;
      return "String_Node_Str";
    }
 else     if (NodeType.ATTRIBUT == bean.getTreeNode().getNodeType()) {
      isValidName=false;
      return "String_Node_Str";
    }
  }
  return validateEntry(newValue,bean,beanPosition);
}
Program: 122907
Project: 122907
Buggy source:
protected String validateNameSpace(String newValue){
  if ((newValue.indexOf("String_Node_Str") != -1 || newValue.indexOf("String_Node_Str") != -1) && !newValue.equals(XmlMapUtil.DEFAULT_NAME_SPACE_PREFIX)) {
    isValidName=false;
    return "String_Node_Str";
  }
  return null;
}

Fixed version (ground truth):
protected String validateNameSpace(String newValue,int beanPosition){
  if ((newValue.indexOf("String_Node_Str") != -1 || newValue.indexOf("String_Node_Str") != -1) && !newValue.equals(XmlMapUtil.DEFAULT_NAME_SPACE_PREFIX)) {
    isValidName=false;
    return "String_Node_Str";
  }
  if (getExtendedTableModel() != null) {
    for (int i=0; i < getExtendedTableModel().getBeansList().size(); i++) {
      if (i == beanPosition) {
        continue;
      }
      TreeSchemaTableEntry entry=getExtendedTableModel().getBeansList().get(i);
      if (NodeType.NAME_SPACE == entry.getTreeNode().getNodeType() && newValue.equals(entry.getName())) {
        isValidName=false;
        return "String_Node_Str";
      }
    }
  }
  return null;
}
Program: 122909
Project: 122909
Buggy source:
@Override public void performRequest(Request req){
  if (req instanceof SelectionRequest) {
    Point location=((SelectionRequest)req).getLocation();
    List<NodeContainer> list=this.getModelChildren();
    for (    NodeContainer nodeCon : list) {
      if (nodeCon.getErrorMarkRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        if (node.isErrorFlag()) {
          Shell shell=Display.getCurrent().getActiveShell();
          ErrorMessageDialog dialog=new ErrorMessageDialog(new Shell(shell),node);
          dialog.open();
          break;
        }
      }
 else       if (nodeCon.getErrorRectangle() != null && nodeCon.getErrorRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        showModules(node);
      }
    }
  }
  super.performRequest(req);
}

Fixed version (ground truth):
@Override public void performRequest(Request req){
  if (req instanceof SelectionRequest) {
    Point location=((SelectionRequest)req).getLocation();
    List<NodeContainer> list=this.getModelChildren();
    for (    NodeContainer nodeCon : list) {
      if (nodeCon.getErrorMarkRectangle() != null && nodeCon.getErrorMarkRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        if (node.isErrorFlag()) {
          Shell shell=Display.getCurrent().getActiveShell();
          ErrorMessageDialog dialog=new ErrorMessageDialog(new Shell(shell),node);
          dialog.open();
          break;
        }
      }
 else       if (nodeCon.getErrorRectangle() != null && nodeCon.getErrorRectangle().contains(location)) {
        Node node=nodeCon.getNode();
        showModules(node);
      }
    }
  }
  super.performRequest(req);
}
Program: 122913
Project: 122913
Buggy source:
/** 
 * Initialisation of the command. ConnectionLabel, Figure that will be the parent to calculate the position of the label, delta of the move of the label after drag it
 * @param label
 * @param parent
 * @param delta
 */
public MoveConnTextCommand(ConnectionLabel label,ConnectionResuming resuming,Figure parent,Point delta){
  this.label=label;
  this.parent=parent;
  this.location=delta;
  this.resuming=resuming;
}

Fixed version (ground truth):
/** 
 * Initialisation of the command. ConnectionLabel, Figure that will be the parent to calculate the position of the label, delta of the move of the label after drag it
 * @param label
 * @param parent
 * @param delta
 */
public MoveConnTextCommand(ConnectionLabel label,ConnectionResuming resuming,Figure parent,Point delta){
  this.label=label;
  this.parent=parent;
  this.location=delta;
  this.resuming=resuming;
  oldOffset=label.getOffset().getCopy();
}
Program: 122914
Project: 122914
Buggy source:
public void execute(){
  oldOffset=label.getOffset();
  Point newOffset=label.getOffset().getCopy();
  parent.translateToAbsolute(newOffset);
  newOffset.translate(location);
  parent.translateToRelative(newOffset);
  label.setOffset(newOffset);
  if (resuming != null)   resuming.setOffset(oldOffset);
}

Fixed version (ground truth):
public void execute(){
  Point newOffset=label.getOffset().getCopy();
  parent.translateToAbsolute(newOffset);
  newOffset.translate(location);
  parent.translateToRelative(newOffset);
  label.setOffset(newOffset);
  if (resuming != null)   resuming.setOffset(oldOffset);
}
Program: 122915
Project: 122915
Buggy source:
/** 
 * Collect the list of .project files that are under directory into files. <br/> Method almost as taken in org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage. Modifications are: <ol> <li>no recusrive search</li> <li>add searchFileName as parameter</li> <li>checks if monitor is null</li> </ol>
 * @param files
 * @param directory
 * @param monitor The monitor to report to
 * @param searchFileName
 * @return boolean <code>true</code> if the operation was completed.
 */
public static boolean collectProjectFilesFromDirectory(Collection files,File directory,IProgressMonitor monitor,String searchFileName){
  if (monitor != null && monitor.isCanceled()) {
    return false;
  }
  if (monitor != null) {
    monitor.subTask(Messages.getString("String_Node_Str",directory.getPath()));
  }
  File[] contents=directory.listFiles();
  for (int i=0; i < contents.length; i++) {
    File file=contents[i];
    if (file.isFile() && file.getName().equals(searchFileName)) {
      files.add(file);
      return true;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Collect the list of .project files that are under directory into files. <br/> Method almost as taken in org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage. Modifications are: <ol> <li>no recusrive search</li> <li>add searchFileName as parameter</li> <li>checks if monitor is null</li> </ol>
 * @param files
 * @param directory
 * @param monitor The monitor to report to
 * @param searchFileName
 * @return boolean <code>true</code> if the operation was completed.
 */
public static boolean collectProjectFilesFromDirectory(Collection files,File directory,IProgressMonitor monitor,String searchFileName){
  if (monitor != null && monitor.isCanceled()) {
    return false;
  }
  if (monitor != null) {
    monitor.subTask(Messages.getString("String_Node_Str",directory.getPath()));
  }
  File[] contents=directory.listFiles();
  for (  File file : contents) {
    if (file.isFile() && file.getName().equals(searchFileName)) {
      files.add(file);
      return true;
    }
  }
  return true;
}
Program: 122916
Project: 122916
Buggy source:
private static void importProject(Shell shell,IImportStructureProvider provider,Object source,IPath path,boolean overwriteResources,boolean createContainerStructure,IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask(Messages.getString("String_Node_Str"),1);
  ArrayList fileSystemObjects=new ArrayList();
  ImportProjectsUtilities.getFilesForProject(fileSystemObjects,provider,source);
  ImportOperation operation=new ImportOperation(path,source,provider,new MyOverwriteQuery(),fileSystemObjects);
  operation.setContext(shell);
  operation.setOverwriteResources(overwriteResources);
  operation.setCreateContainerStructure(createContainerStructure);
  operation.run(new SubProgressMonitor(monitor,1));
  monitor.done();
}

Fixed version (ground truth):
private static void importProject(Shell shell,IImportStructureProvider provider,Object source,IPath path,boolean overwriteResources,boolean createContainerStructure,IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask(Messages.getString("String_Node_Str"),100);
  ArrayList fileSystemObjects=new ArrayList();
  ImportProjectsUtilities.getFilesForProject(fileSystemObjects,provider,source);
  ImportOperation operation=new ImportOperation(path,source,provider,new MyOverwriteQuery(),fileSystemObjects);
  operation.setContext(shell);
  operation.setOverwriteResources(overwriteResources);
  operation.setCreateContainerStructure(createContainerStructure);
  operation.run(new SubProgressMonitor(monitor,95));
  monitor.worked(5);
  monitor.done();
}
Program: 122917
Project: 122917
Buggy source:
/** 
 * Gets the path of demo projects xml file.
 * @return String
 */
private static List<File> getXMLFilePath(){
  List<File> xmlListFile=new ArrayList<File>();
  String[] pluginIDs=new String[]{ResourcesPlugin.PLUGIN_ID,"String_Node_Str",ResourcesPlugin.TDQ_PLUGIN_ID,getMDMDemoPluginId()};
  for (int i=0; i < pluginIDs.length; i++) {
    Bundle bundle=Platform.getBundle(pluginIDs[i]);
    if (bundle != null) {
      URL url=null;
      String fullPath=XML_FILE_PATH;
      if (ResourcesPlugin.TDQ_PLUGIN_ID.equals(pluginIDs[i])) {
        fullPath=PluginConstant.EMPTY_STRING;
      }
      URL fileUrl=FileLocator.find(bundle,new Path(fullPath),null);
      try {
        if (fileUrl != null) {
          url=FileLocator.toFileURL(fileUrl);
        }
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
      if (url == null)       continue;
      File xmlFilePath=new File(url.getPath());
      if (xmlFilePath.exists()) {
        String files[]=xmlFilePath.list(new FilenameFilter(){
          public boolean accept(          File arg0,          String arg1){
            return XmlUtil.isXMLFile(arg1);
          }
        }
);
        for (        String file : files) {
          File xml=new File(url.getPath() + "String_Node_Str" + file);
          xmlListFile.add(xml);
        }
      }
    }
  }
  return xmlListFile;
}

Fixed version (ground truth):
/** 
 * Gets the path of demo projects xml file.
 * @return String
 */
private static List<File> getXMLFilePath(){
  List<File> xmlListFile=new ArrayList<File>();
  String[] pluginIDs=new String[]{ResourcesPlugin.PLUGIN_ID,"String_Node_Str",ResourcesPlugin.TDQ_PLUGIN_ID,getMDMDemoPluginId()};
  for (  String pluginID : pluginIDs) {
    Bundle bundle=Platform.getBundle(pluginID);
    if (bundle != null) {
      URL url=null;
      String fullPath=XML_FILE_PATH;
      if (ResourcesPlugin.TDQ_PLUGIN_ID.equals(pluginID)) {
        fullPath=PluginConstant.EMPTY_STRING;
      }
      URL fileUrl=FileLocator.find(bundle,new Path(fullPath),null);
      try {
        if (fileUrl != null) {
          url=FileLocator.toFileURL(fileUrl);
        }
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
      if (url == null) {
        continue;
      }
      File xmlFilePath=new File(url.getPath());
      if (xmlFilePath.exists()) {
        String files[]=xmlFilePath.list(new FilenameFilter(){
          public boolean accept(          File arg0,          String arg1){
            return XmlUtil.isXMLFile(arg1);
          }
        }
);
        for (        String file : files) {
          File xml=new File(url.getPath() + "String_Node_Str" + file);
          xmlListFile.add(xml);
        }
      }
    }
  }
  return xmlListFile;
}
Program: 122920
Project: 122920
Buggy source:
public void widgetDisposed(final DisposeEvent e){
  if (thumbnail != null) {
    thumbnail.deactivate();
    thumbnail=null;
  }
}

Fixed version (ground truth):
@Override public void widgetDisposed(final DisposeEvent e){
  if (thumbnail != null) {
    thumbnail.deactivate();
    thumbnail=null;
  }
}
Program: 122921
Project: 122921
Buggy source:
public Object getAdapter(final Class type){
  if (type == ZoomManager.class) {
    return getGraphicalViewer().getProperty(ZoomManager.class.toString());
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getAdapter(final Class type){
  if (type == ZoomManager.class) {
    return getGraphicalViewer().getProperty(ZoomManager.class.toString());
  }
  return null;
}
Program: 122922
Project: 122922
Buggy source:
public JobResource getJobResource(String id){
  return protectedJobs.get(id);
}

Fixed version (ground truth):
@Override public JobResource getJobResource(String id){
  return protectedJobs.get(id);
}
Program: 122923
Project: 122923
Buggy source:
public String[] calculateProtectedIds(){
  IProcess2 process=getProcess();
  if (!(process.getProperty().getItem() instanceof ProcessItem)) {
    return new String[]{};
  }
  String currentJobId="String_Node_Str" + projectName + "String_Node_Str"+ process.getLabel()+ "String_Node_Str"+ process.getVersion();
  protectedJobs.put(currentJobId,currentJobResource);
  Set<String> set=protectedJobs.keySet();
  return set.toArray(new String[set.size()]);
}

Fixed version (ground truth):
@Override public String[] calculateProtectedIds(){
  IProcess2 process=getProcess();
  if (!(process.getProperty().getItem() instanceof ProcessItem)) {
    return new String[]{};
  }
  String currentJobId="String_Node_Str" + projectName + "String_Node_Str"+ process.getLabel()+ "String_Node_Str"+ process.getVersion();
  protectedJobs.put(currentJobId,currentJobResource);
  Set<String> set=protectedJobs.keySet();
  return set.toArray(new String[set.size()]);
}
Program: 122924
Project: 122924
Buggy source:
public void createPartControl(Composite parent){
  TalendFlyoutPaletteComposite talendSplitter=new TalendFlyoutPaletteComposite(parent,SWT.NONE,getSite().getPage(),getPaletteViewerProvider(),getPalettePreferences());
  try {
    splitterField.set(this,talendSplitter);
  }
 catch (  IllegalArgumentException e) {
    handleReflectionFailure(e);
  }
catch (  IllegalAccessException e) {
    handleReflectionFailure(e);
  }
  createGraphicalViewer(talendSplitter);
  talendSplitter.setGraphicalControl(getGraphicalControl());
  Object hookPage;
  try {
    hookPage=pageField.get(this);
    if (hookPage != null && hookPage instanceof CustomPalettePage) {
      talendSplitter.setExternalViewer(((CustomPalettePage)hookPage).getPaletteViewer());
      pageField.set(this,null);
    }
  }
 catch (  IllegalArgumentException e) {
    handleReflectionFailure(e);
  }
catch (  IllegalAccessException e) {
    handleReflectionFailure(e);
  }
  TalendPaletteHelper.checkAndInitToolBar();
}

Fixed version (ground truth):
@Override public void createPartControl(Composite parent){
  TalendFlyoutPaletteComposite talendSplitter=new TalendFlyoutPaletteComposite(parent,SWT.NONE,getSite().getPage(),getPaletteViewerProvider(),getPalettePreferences());
  try {
    splitterField.set(this,talendSplitter);
  }
 catch (  IllegalArgumentException e) {
    handleReflectionFailure(e);
  }
catch (  IllegalAccessException e) {
    handleReflectionFailure(e);
  }
  createGraphicalViewer(talendSplitter);
  talendSplitter.setGraphicalControl(getGraphicalControl());
  Object hookPage;
  try {
    hookPage=pageField.get(this);
    if (hookPage != null && hookPage instanceof CustomPalettePage) {
      talendSplitter.setExternalViewer(((CustomPalettePage)hookPage).getPaletteViewer());
      pageField.set(this,null);
    }
  }
 catch (  IllegalArgumentException e) {
    handleReflectionFailure(e);
  }
catch (  IllegalAccessException e) {
    handleReflectionFailure(e);
  }
  TalendPaletteHelper.checkAndInitToolBar();
}
Program: 122925
Project: 122925
Buggy source:
@Override public void doSave(IProgressMonitor monitor){
  monitor.beginTask("String_Node_Str",100);
  monitor.worked(10);
  savePreviewPictures();
  try {
    if (getEditorInput() instanceof JobEditorInput) {
      boolean saved=((JobEditorInput)getEditorInput()).saveProcess(new SubProgressMonitor(monitor,80),null);
      if (!saved) {
        monitor.setCanceled(true);
        throw new InterruptedException();
      }
    }
    getCommandStack().markSaveLocation();
    setDirty(false);
    boolean isneedReload=false;
    for (int i=0; i < getProcess().getGraphicalNodes().size(); i++) {
      Node node=(Node)getProcess().getGraphicalNodes().get(i);
      if (node.isNeedloadLib()) {
        isneedReload=true;
        node.setNeedLoadLib(false);
      }
    }
    if (isneedReload)     ((ILibrariesService)GlobalServiceRegister.getDefault().getService(ILibrariesService.class)).updateModulesNeededForCurrentJob(getProcess());
    monitor.worked(10);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    monitor.setCanceled(true);
  }
 finally {
    monitor.done();
  }
}

Fixed version (ground truth):
@Override public void doSave(IProgressMonitor monitor){
  monitor.beginTask("String_Node_Str",100);
  monitor.worked(10);
  savePreviewPictures();
  try {
    if (getEditorInput() instanceof JobEditorInput) {
      boolean saved=((JobEditorInput)getEditorInput()).saveProcess(new SubProgressMonitor(monitor,80),null);
      if (!saved) {
        monitor.setCanceled(true);
        throw new InterruptedException();
      }
    }
    getCommandStack().markSaveLocation();
    setDirty(false);
    boolean isneedReload=false;
    for (int i=0; i < getProcess().getGraphicalNodes().size(); i++) {
      Node node=(Node)getProcess().getGraphicalNodes().get(i);
      if (node.isNeedloadLib()) {
        isneedReload=true;
        node.setNeedLoadLib(false);
      }
    }
    if (isneedReload) {
      ((ILibrariesService)GlobalServiceRegister.getDefault().getService(ILibrariesService.class)).updateModulesNeededForCurrentJob(getProcess());
    }
    monitor.worked(10);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    monitor.setCanceled(true);
  }
 finally {
    monitor.done();
  }
}
Program: 122927
Project: 122927
Buggy source:
protected void initializeOverview(){
  LightweightSystem lws=new LightweightSystem(overview);
  RootEditPart rep=getGraphicalViewer().getRootEditPart();
  if (rep instanceof ScalableFreeformRootEditPart) {
    ScalableFreeformRootEditPart root=(ScalableFreeformRootEditPart)rep;
    thumbnail=new ScrollableThumbnail((Viewport)root.getFigure());
    thumbnail.setBorder(new SimpleRaisedBorder());
    thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS));
    lws.setContents(thumbnail);
    disposeListener=new DisposeListener(){
      public void widgetDisposed(      final DisposeEvent e){
        if (thumbnail != null) {
          thumbnail.deactivate();
          thumbnail=null;
        }
      }
    }
;
    getEditor().addDisposeListener(disposeListener);
  }
}

Fixed version (ground truth):
protected void initializeOverview(){
  LightweightSystem lws=new LightweightSystem(overview);
  RootEditPart rep=getGraphicalViewer().getRootEditPart();
  if (rep instanceof ScalableFreeformRootEditPart) {
    ScalableFreeformRootEditPart root=(ScalableFreeformRootEditPart)rep;
    thumbnail=new ScrollableThumbnail((Viewport)root.getFigure());
    thumbnail.setBorder(new SimpleRaisedBorder());
    thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS));
    lws.setContents(thumbnail);
    disposeListener=new DisposeListener(){
      @Override public void widgetDisposed(      final DisposeEvent e){
        if (thumbnail != null) {
          thumbnail.deactivate();
          thumbnail=null;
        }
      }
    }
;
    getEditor().addDisposeListener(disposeListener);
  }
}
Program: 122928
Project: 122928
Buggy source:
public void verifyKey(VerifyEvent event){
}

Fixed version (ground truth):
@Override public void verifyKey(VerifyEvent event){
}
Program: 122929
Project: 122929
Buggy source:
public String[] getProtectedIds(){
  Set<String> set=protectedJobs.keySet();
  return set.toArray(new String[set.size()]);
}

Fixed version (ground truth):
@Override public String[] getProtectedIds(){
  Set<String> set=protectedJobs.keySet();
  return set.toArray(new String[set.size()]);
}
Program: 122930
Project: 122930
Buggy source:
public void setDirty(boolean dirty){
  dirtyState=dirty;
  if (dirtyState) {
    firePropertyChange(IEditorPart.PROP_DIRTY);
  }
}

Fixed version (ground truth):
@Override public void setDirty(boolean dirty){
  dirtyState=dirty;
  if (dirtyState) {
    firePropertyChange(IEditorPart.PROP_DIRTY);
  }
}
Program: 122931
Project: 122931
Buggy source:
/** 
 * DOC bqian Comment method "moveShape".
 * @param keyCode
 * @param shape
 */
private void moveShape(int keyCode,Node node,int offset){
  Point location=node.getLocation().getCopy();
  if (location == null)   return;
switch (keyCode) {
case SWT.ARROW_UP:
    location.y=location.y - offset;
  break;
case SWT.ARROW_DOWN:
location.y=location.y + offset;
break;
case SWT.ARROW_LEFT:
location.x=location.x - offset;
break;
case SWT.ARROW_RIGHT:
location.x=location.x + offset;
break;
default :
}
MoveNodeCommand locationCommand=new MoveNodeCommand(node,location);
getCommandStack().execute(locationCommand);
}

Fixed version (ground truth):
/** 
 * DOC bqian Comment method "moveShape".
 * @param keyCode
 * @param shape
 */
private void moveShape(int keyCode,Node node,int offset){
  Point location=node.getLocation().getCopy();
  if (location == null) {
    return;
  }
switch (keyCode) {
case SWT.ARROW_UP:
    location.y=location.y - offset;
  break;
case SWT.ARROW_DOWN:
location.y=location.y + offset;
break;
case SWT.ARROW_LEFT:
location.x=location.x - offset;
break;
case SWT.ARROW_RIGHT:
location.x=location.x + offset;
break;
default :
}
MoveNodeCommand locationCommand=new MoveNodeCommand(node,location);
getCommandStack().execute(locationCommand);
}
Program: 122932
Project: 122932
Buggy source:
public Object getObjectType(){
  return mainConnector.getName();
}

Fixed version (ground truth):
@Override public Object getObjectType(){
  return mainConnector.getName();
}
Program: 122933
Project: 122933
Buggy source:
public Object getNewObject(){
  return listArgs;
}

Fixed version (ground truth):
@Override public Object getNewObject(){
  return listArgs;
}
Program: 122934
Project: 122934
Buggy source:
/** 
 * This function is used only for the TabbedPropertySheetPage.
 * @return contributorId String
 */
public String getContributorId(){
  return IRepositoryView.VIEW_ID;
}

Fixed version (ground truth):
/** 
 * This function is used only for the TabbedPropertySheetPage.
 * @return contributorId String
 */
@Override public String getContributorId(){
  return IRepositoryView.VIEW_ID;
}
Program: 122935
Project: 122935
Buggy source:
/** 
 * Initialisation of the command. ConnectionLabel, Figure that will be the parent to calculate the position of the label, delta of the move of the label after drag it
 * @param label
 * @param parent
 * @param delta
 */
public MoveConnTextCommand(ConnectionLabel label,ConnectionResuming resuming,Figure parent,Point delta){
  this.label=label;
  this.parent=parent;
  this.location=delta;
  this.resuming=resuming;
}

Fixed version (ground truth):
/** 
 * Initialisation of the command. ConnectionLabel, Figure that will be the parent to calculate the position of the label, delta of the move of the label after drag it
 * @param label
 * @param parent
 * @param delta
 */
public MoveConnTextCommand(ConnectionLabel label,ConnectionResuming resuming,Figure parent,Point delta){
  this.label=label;
  this.parent=parent;
  this.location=delta;
  this.resuming=resuming;
  oldOffset=label.getOffset().getCopy();
}
Program: 122936
Project: 122936
Buggy source:
public void undo(){
  label.setOffset(oldOffset);
}

Fixed version (ground truth):
@Override public void undo(){
  label.setOffset(oldOffset);
}
Program: 122937
Project: 122937
Buggy source:
public void redo(){
  execute();
}

Fixed version (ground truth):
@Override public void redo(){
  execute();
}
Program: 122938
Project: 122938
Buggy source:
public void execute(){
  oldOffset=label.getOffset();
  Point newOffset=label.getOffset().getCopy();
  parent.translateToAbsolute(newOffset);
  newOffset.translate(location);
  parent.translateToRelative(newOffset);
  label.setOffset(newOffset);
  if (resuming != null)   resuming.setOffset(oldOffset);
}

Fixed version (ground truth):
@Override public void execute(){
  Point newOffset=label.getOffset().getCopy();
  parent.translateToAbsolute(newOffset);
  newOffset.translate(location);
  parent.translateToRelative(newOffset);
  label.setOffset(newOffset);
  if (resuming != null) {
    resuming.setOffset(oldOffset);
  }
}
Program: 122939
Project: 122939
Buggy source:
/** 
 * Initialisation of the command. ConnectionLabel, Figure that will be the parent to calculate the position of the label, delta of the move of the label after drag it
 * @param label
 * @param parent
 * @param delta
 */
public MoveConnTextCommand(ConnectionLabel label,ConnectionResuming resuming,Figure parent,Point delta){
  this.label=label;
  this.parent=parent;
  this.location=delta;
  this.resuming=resuming;
}

Fixed version (ground truth):
/** 
 * Initialisation of the command. ConnectionLabel, Figure that will be the parent to calculate the position of the label, delta of the move of the label after drag it
 * @param label
 * @param parent
 * @param delta
 */
public MoveConnTextCommand(ConnectionLabel label,ConnectionResuming resuming,Figure parent,Point delta){
  this.label=label;
  this.parent=parent;
  this.location=delta;
  this.resuming=resuming;
  oldOffset=label.getOffset().getCopy();
}
Program: 122940
Project: 122940
Buggy source:
public void execute(){
  oldOffset=label.getOffset();
  Point newOffset=label.getOffset().getCopy();
  parent.translateToAbsolute(newOffset);
  newOffset.translate(location);
  parent.translateToRelative(newOffset);
  label.setOffset(newOffset);
  if (resuming != null)   resuming.setOffset(oldOffset);
}

Fixed version (ground truth):
public void execute(){
  Point newOffset=label.getOffset().getCopy();
  parent.translateToAbsolute(newOffset);
  newOffset.translate(location);
  parent.translateToRelative(newOffset);
  label.setOffset(newOffset);
  if (resuming != null)   resuming.setOffset(oldOffset);
}
Program: 122942
Project: 122942
Buggy source:
public static List<String> getStatusList(ProblemStatus status,Node element){
  List<String> statusList=new ArrayList<String>();
  for (  Problem problem : problemList.getProblemList()) {
    String elementUniqueName=element.getLabel();
    if (element.isJoblet()) {
      elementUniqueName=element.getUniqueName();
    }
    if (problem.getNodeName() != null && problem.getNodeName().equals(elementUniqueName) && problem.getStatus().equals(status)) {
      statusList.add(problem.getDescription());
    }
  }
  return statusList;
}

Fixed version (ground truth):
public static List<String> getStatusList(ProblemStatus status,Node element){
  List<String> statusList=new ArrayList<String>();
  for (  Problem problem : problemList.getProblemList()) {
    String elementUniqueName=element.getUniqueName();
    if (problem.getNodeName() != null && problem.getNodeName().equals(elementUniqueName) && problem.getStatus().equals(status)) {
      statusList.add(problem.getDescription());
    }
  }
  return statusList;
}
Program: 122948
Project: 122948
Buggy source:
private static void importProject(Shell shell,IImportStructureProvider provider,Object source,IPath path,boolean overwriteResources,boolean createContainerStructure,IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask(Messages.getString("String_Node_Str"),1);
  ArrayList fileSystemObjects=new ArrayList();
  ImportProjectsUtilities.getFilesForProject(fileSystemObjects,provider,source);
  ImportOperation operation=new ImportOperation(path,source,provider,new MyOverwriteQuery(),fileSystemObjects);
  operation.setContext(shell);
  operation.setOverwriteResources(overwriteResources);
  operation.setCreateContainerStructure(createContainerStructure);
  operation.run(new SubProgressMonitor(monitor,1));
  monitor.done();
}

Fixed version (ground truth):
private static void importProject(Shell shell,IImportStructureProvider provider,Object source,IPath path,boolean overwriteResources,boolean createContainerStructure,IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask(Messages.getString("String_Node_Str"),100);
  ArrayList fileSystemObjects=new ArrayList();
  ImportProjectsUtilities.getFilesForProject(fileSystemObjects,provider,source);
  ImportOperation operation=new ImportOperation(path,source,provider,new MyOverwriteQuery(),fileSystemObjects);
  operation.setContext(shell);
  operation.setOverwriteResources(overwriteResources);
  operation.setCreateContainerStructure(createContainerStructure);
  operation.run(new SubProgressMonitor(monitor,95));
  monitor.worked(5);
  monitor.done();
}
Program: 122949
Project: 122949
Buggy source:
protected void writeFields(com.sforce.ws.parser.XmlOutputStream __out,com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException {
  __typeMapper.writeBoolean(__out,cascadeDelete__typeInfo,cascadeDelete,cascadeDelete__is_set);
  __typeMapper.writeString(__out,childSObject__typeInfo,childSObject,childSObject__is_set);
  __typeMapper.writeBoolean(__out,deprecatedAndHidden__typeInfo,deprecatedAndHidden,deprecatedAndHidden__is_set);
  __typeMapper.writeString(__out,field__typeInfo,field,field__is_set);
  __typeMapper.writeString(__out,relationshipName__typeInfo,relationshipName,relationshipName__is_set);
}

Fixed version (ground truth):
protected void writeFields(com.sforce.ws.parser.XmlOutputStream __out,com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException {
  __typeMapper.writeBoolean(__out,cascadeDelete__typeInfo,cascadeDelete,cascadeDelete__is_set);
  __typeMapper.writeString(__out,childSObject__typeInfo,childSObject,childSObject__is_set);
  __typeMapper.writeBoolean(__out,deprecatedAndHidden__typeInfo,deprecatedAndHidden,deprecatedAndHidden__is_set);
  __typeMapper.writeString(__out,field__typeInfo,field,field__is_set);
  __typeMapper.writeString(__out,relationshipName__typeInfo,relationshipName,relationshipName__is_set);
  __typeMapper.writeBoolean(__out,restrictedDelete__typeInfo,restrictedDelete,restrictedDelete__is_set);
}