nus-yam/ex-repair huggingface dataset:
Program: 95961
Project: 95961
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void setSelection(ISelection selection){
  ISelection newSelection=getMainTreeViewer().getSelection();
  if (selection instanceof StructuredSelection) {
    Object firstElement=((StructuredSelection)selection).getFirstElement();
    if (firstElement instanceof INodePO) {
      INodePO node=(INodePO)firstElement;
      final IPersistentObject editorRoot=getWorkVersion();
      if (editorRoot.getId().equals(node.getId())) {
        newSelection=new StructuredSelection(editorRoot);
      }
 else {
        Iterator<? extends INodePO> nodeListIterator=getIteratorForNode(node);
        while (nodeListIterator.hasNext()) {
          INodePO child=nodeListIterator.next();
          if (node.getId().equals(child.getId())) {
            newSelection=new StructuredSelection(child);
            break;
          }
        }
      }
    }
  }
  setSelectionImpl(newSelection);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void setSelection(ISelection selection){
  ISelection newSelection=getMainTreeViewer().getSelection();
  if (selection instanceof StructuredSelection) {
    Object firstElement=((StructuredSelection)selection).getFirstElement();
    if (firstElement instanceof INodePO) {
      INodePO node=(INodePO)firstElement;
      final IPersistentObject editorRoot=getWorkVersion();
      if (editorRoot.getId().equals(node.getId())) {
        newSelection=new StructuredSelection(editorRoot);
      }
 else {
        Iterator<? extends INodePO> nodeListIterator=getIteratorForNode(node);
        while (nodeListIterator.hasNext()) {
          INodePO child=nodeListIterator.next();
          if (node.getGuid().equals(child.getGuid())) {
            newSelection=new StructuredSelection(child);
            break;
          }
        }
      }
    }
  }
  setSelectionImpl(newSelection);
}
Program: 95962
Project: 95962
Buggy source:
/** 
 * @param objectToAdapt 
 * @return -
 */
public IComponentAdapter getAdapter(Object objectToAdapt){
  Class adapteeclass=objectToAdapt.getClass();
  IUIAdapterFactory factory=(IUIAdapterFactory)m_registrationMap.get(adapteeclass);
  Class superclass=adapteeclass;
  while (factory == null && superclass != Object.class) {
    factory=(IUIAdapterFactory)m_registrationMap.get(superclass);
    superclass=superclass.getSuperclass();
  }
  return factory.getAdapter(objectToAdapt);
}

Fixed version (ground truth):
/** 
 * @param objectToAdapt 
 * @return -
 */
public IComponentAdapter getAdapter(Object objectToAdapt){
  Class adapteeclass=objectToAdapt.getClass();
  IUIAdapterFactory factory=(IUIAdapterFactory)m_registrationMap.get(adapteeclass);
  Class superclass=adapteeclass;
  while (factory == null && superclass != Object.class) {
    factory=(IUIAdapterFactory)m_registrationMap.get(superclass);
    superclass=superclass.getSuperclass();
  }
  if (factory != null) {
    return factory.getAdapter(objectToAdapt);
  }
  return null;
}
Program: 95963
Project: 95963
Buggy source:
/** 
 * Use this to handle the Highlighting after a Click.
 * @param implClass IImplementationClass
 * @param highlightColor highlight clolor
 */
protected void highlightClicked(final Object implClass,final Color highlightColor){
  Timer timer=new Timer(REPAINT_DELAY,new ActionListener(){
    public void actionPerformed(    ActionEvent e){
synchronized (getComponentLock()) {
        if (getCurrentComponent() != null && getCurrentComponent().isShowing() && SwingUtilities.getWindowAncestor(getCurrentComponent()) != null && SwingUtilities.getWindowAncestor(getCurrentComponent()).getFocusOwner() != null) {
          Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
          ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
          setHighLighted(true);
        }
      }
    }
  }
);
  timer.setRepeats(false);
  timer.start();
}

Fixed version (ground truth):
/** 
 * Use this to handle the Highlighting after a Click.
 * @param implClass IImplementationClass
 * @param highlightColor highlight clolor
 */
protected void highlightClicked(final Object implClass,final Color highlightColor){
  Timer timer=new Timer(REPAINT_DELAY,new ActionListener(){
    public void actionPerformed(    ActionEvent e){
synchronized (getComponentLock()) {
        if (getCurrentComponent() != null && getCurrentComponent().isShowing() && SwingUtilities.getWindowAncestor(getCurrentComponent()) != null && SwingUtilities.getWindowAncestor(getCurrentComponent()).getFocusOwner() != null) {
          try {
            AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
            TesterUtil.highLight(getCurrentComponent(),highlightColor);
          }
 catch (          IllegalArgumentException iae) {
            log.error("String_Node_Str",iae);
          }
catch (          UnsupportedComponentException uce) {
          }
        }
      }
    }
  }
);
  timer.setRepeats(false);
  timer.start();
}
Program: 95964
Project: 95964
Buggy source:
/** 
 * Handles the High-/Lowlighting.<br> When High-/LowLighting afer a click use highlightClicked.
 * @param source Component
 * @param implClass IImplementationClass
 * @param highlightColor highlight clolor
 * @see AbstractGDAutSwingEventListener#highlightClicked(Object,Color)
 */
protected void highlight(Component source,final Object implClass,final Color highlightColor){
  Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(source);
synchronized (getComponentLock()) {
    if (getCurrentComponent() != null && getCurrentComponent() != source) {
      ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class},new Object[]{getCurrentComponent()});
      setHighLighted(false);
    }
    setCurrentComponent(source);
    Window windowAncestor=SwingUtilities.getWindowAncestor(getCurrentComponent());
    if (windowAncestor != null && windowAncestor.getFocusOwner() != null) {
      ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      setHighLighted(true);
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles the High-/Lowlighting.<br> When High-/LowLighting afer a click use highlightClicked.
 * @param source Component
 * @param implClass IImplementationClass
 * @param highlightColor highlight clolor
 * @see AbstractGDAutSwingEventListener#highlightClicked(Object,Color)
 */
protected void highlight(Component source,final Object implClass,final Color highlightColor){
synchronized (getComponentLock()) {
    if (getCurrentComponent() != null && getCurrentComponent() != source) {
      TesterUtil.lowLight(getCurrentComponent());
      setHighLighted(false);
    }
    setCurrentComponent(source);
    Window windowAncestor=SwingUtilities.getWindowAncestor(getCurrentComponent());
    if (windowAncestor != null && windowAncestor.getFocusOwner() != null) {
      try {
        AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
        TesterUtil.highLight(getCurrentComponent(),highlightColor);
        setHighLighted(true);
      }
 catch (      IllegalArgumentException e) {
        log.error("String_Node_Str",e);
      }
catch (      UnsupportedComponentException e) {
      }
    }
  }
}
Program: 95965
Project: 95965
Buggy source:
public void actionPerformed(ActionEvent e){
synchronized (getComponentLock()) {
    if (getCurrentComponent() != null && getCurrentComponent().isShowing() && SwingUtilities.getWindowAncestor(getCurrentComponent()) != null && SwingUtilities.getWindowAncestor(getCurrentComponent()).getFocusOwner() != null) {
      Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
      ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      setHighLighted(true);
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
synchronized (getComponentLock()) {
    if (getCurrentComponent() != null && getCurrentComponent().isShowing() && SwingUtilities.getWindowAncestor(getCurrentComponent()) != null && SwingUtilities.getWindowAncestor(getCurrentComponent()).getFocusOwner() != null) {
      try {
        AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
        TesterUtil.highLight(getCurrentComponent(),highlightColor);
      }
 catch (      IllegalArgumentException iae) {
        log.error("String_Node_Str",iae);
      }
catch (      UnsupportedComponentException uce) {
      }
    }
  }
}
Program: 95966
Project: 95966
Buggy source:
/** 
 * This method is called by the AUTServer AFTER this instance is removed as AWTEventListener for cleaning up purpose. <br> low lights the last hight lighted component.
 */
public void cleanUp(){
synchronized (m_componentLock) {
    if (getCurrentComponent() != null) {
      try {
        Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
        if (adapter != null) {
          ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class},new Object[]{m_currentComponent});
          setHighLighted(false);
        }
      }
 catch (      IllegalArgumentException iae) {
        log.error(iae);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This method is called by the AUTServer AFTER this instance is removed as AWTEventListener for cleaning up purpose. <br> low lights the last hight lighted component.
 */
public void cleanUp(){
synchronized (m_componentLock) {
    if (getCurrentComponent() != null) {
      try {
        AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
        TesterUtil.lowLight(m_currentComponent);
      }
 catch (      IllegalArgumentException iae) {
        log.error(iae);
      }
catch (      UnsupportedComponentException uce) {
        log.warn(uce);
      }
    }
  }
}
Program: 95967
Project: 95967
Buggy source:
/** 
 * highlights a component
 * @param compId Component
 * @return boolean succsessful?
 */
public boolean highlightComponent(IComponentIdentifier compId){
  final Color highlightColor=null;
  Component component=null;
  try {
    if (getCurrentComponent() != null) {
      Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
      if (adapter != null) {
        ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class},new Object[]{getCurrentComponent()});
        setHighLighted(false);
      }
    }
    component=ComponentHandler.findComponent(compId,false,0);
    if (component != null) {
      setCurrentComponent(component);
      if (getCurrentComponent() != null && getCurrentComponent().isShowing() && getCurrentComponent().isVisible()) {
        Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
        ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
        setHighLighted(true);
        return true;
      }
    }
 else {
      return false;
    }
  }
 catch (  ComponentNotFoundException e) {
    log.warn(e);
  }
catch (  IllegalArgumentException e) {
    log.warn(e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * highlights a component
 * @param compId Component
 * @return boolean succsessful?
 */
public boolean highlightComponent(IComponentIdentifier compId){
  final Color highlightColor=null;
  Component component=null;
  try {
    if (getCurrentComponent() != null) {
      AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
      TesterUtil.lowLight(getCurrentComponent());
      setHighLighted(false);
    }
    component=ComponentHandler.findComponent(compId,false,0);
    if (component != null) {
      setCurrentComponent(component);
      if (getCurrentComponent() != null && getCurrentComponent().isShowing() && getCurrentComponent().isVisible()) {
        AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
        TesterUtil.highLight(getCurrentComponent(),highlightColor);
        setHighLighted(true);
        return true;
      }
    }
 else {
      return false;
    }
  }
 catch (  ComponentNotFoundException e) {
    log.warn(e);
  }
catch (  IllegalArgumentException e) {
    log.warn(e);
  }
catch (  UnsupportedComponentException uce) {
    log.warn(uce);
  }
  return false;
}
Program: 95968
Project: 95968
Buggy source:
/** 
 * repaints the border
 */
public void update(){
  final Color highlightColor=null;
  if (getCurrentComponent() != null) {
    try {
      Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
      if (adapter != null) {
        ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      }
    }
 catch (    IllegalArgumentException e) {
      log.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * repaints the border
 */
public void update(){
  final Color highlightColor=null;
  if (getCurrentComponent() != null) {
    try {
      AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
      TesterUtil.highLight(getCurrentComponent(),highlightColor);
    }
 catch (    IllegalArgumentException e) {
      log.error("String_Node_Str",e);
    }
catch (    UnsupportedComponentException e) {
    }
  }
}
Program: 95969
Project: 95969
Buggy source:
/** 
 * Update internal db statistics after mass changes in the db. This is often needed to help the query optimizer doing the right things.
 */
public void updateDbStatistics(){
  String cmd=dbConnectionInfo.getStatisticsCommand();
  if (cmd != null) {
    EntityManager em=openSession();
    try {
      Query q=em.createNativeQuery(cmd);
      EntityTransaction tx=getTransaction(em);
      q.executeUpdate();
      commitTransaction(em,tx);
    }
 catch (    Exception e) {
      System.out.println(e.getMessage());
    }
 finally {
      dropSession(em);
    }
  }
}

Fixed version (ground truth):
/** 
 * Update internal db statistics after mass changes in the db. This is often needed to help the query optimizer doing the right things.
 */
public void updateDbStatistics(){
  String cmd=dbConnectionInfo.getStatisticsCommand();
  if (cmd != null) {
    EntityManager em=openSession();
    try {
      Query q=em.createNativeQuery(cmd);
      EntityTransaction tx=getTransaction(em);
      q.executeUpdate();
      commitTransaction(em,tx);
    }
 catch (    Throwable t) {
      log.error("String_Node_Str",t);
    }
 finally {
      dropSession(em);
    }
  }
}
Program: 95971
Project: 95971
Buggy source:
/** 
 * Reopens the Editor with the changed node
 * @param node the changed node of this editor.
 * @throws PMException if the node can not be loaded
 */
public void reOpenEditor(IPersistentObject node) throws PMException {
  getEditorHelper().setDirty(false);
  getEditorHelper().getEditSupport().reloadEditSession();
  ((PersistableEditorInput)getEditorInput()).refreshNode();
  try {
    init(getEditorSite(),getEditorInput());
    setInitialInput();
  }
 catch (  PartInitException e) {
    getSite().getPage().closeEditor(this,false);
  }
}

Fixed version (ground truth):
/** 
 * Reopens the Editor with the changed node
 * @param node the changed node of this editor.
 * @throws PMException if the node can not be loaded
 */
public void reOpenEditor(IPersistentObject node) throws PMException {
  ISelection previousSelection=getSelection();
  getEditorHelper().setDirty(false);
  getEditorHelper().getEditSupport().reloadEditSession();
  ((PersistableEditorInput)getEditorInput()).refreshNode();
  try {
    init(getEditorSite(),getEditorInput());
    setInitialInput();
    setSelection(previousSelection);
  }
 catch (  PartInitException e) {
    getSite().getPage().closeEditor(this,false);
  }
}
Program: 95972
Project: 95972
Buggy source:
/** 
 * Performs the given <code>operation</code> within the context of the receiver's editor. The operation is "wrapped" between a request for an editable state and a reset of editable state (if the editor is not marked as dirty by the end of the operation. The operation is executed in the same thread in which this method is called. 
 * @param operation The operation to perform.
 */
public void doEditorOperation(IEditorOperation operation){
  if (requestEditableState() == EditableState.OK) {
    try {
      operation.run(getEditSupport().getWorkVersion());
    }
  finally {
      if (!m_editor.isDirty()) {
        try {
          resetEditableState();
          getEditSupport().reloadEditSession();
        }
 catch (        PMException e) {
          PMExceptionHandler.handlePMExceptionForEditor(e,m_editor);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs the given <code>operation</code> within the context of the receiver's editor. The operation is "wrapped" between a request for an editable state and a reset of editable state (if the editor is not marked as dirty by the end of the operation. The operation is executed in the same thread in which this method is called. 
 * @param operation The operation to perform.
 */
public void doEditorOperation(IEditorOperation operation){
  if (requestEditableState() == EditableState.OK) {
    try {
      operation.run(getEditSupport().getWorkVersion());
    }
  finally {
      final IJBEditor editor=m_editor;
      if (!editor.isDirty()) {
        try {
          editor.reOpenEditor(getEditSupport().getOriginal());
        }
 catch (        PMException e) {
          PMExceptionHandler.handlePMExceptionForEditor(e,editor);
        }
      }
    }
  }
}
Program: 95973
Project: 95973
Buggy source:
/** 
 * Searchs for the component in the AUT with the given <code>componentIdentifier</code>.
 * @param componentIdentifier the identifier created in object mapping mode
 * @throws IllegalArgumentException if the given identifer is null or <br>the hierarchy is not valid: empty or containing null elements
 * @throws InvalidDataException if the hierarchy in the componentIdentifier does not consist of strings
 * @throws ComponentNotManagedException if no component could be found for the identifier
 * @return the instance of the component of the AUT 
 */
public Component findComponent(IComponentIdentifier componentIdentifier) throws IllegalArgumentException, ComponentNotManagedException, InvalidDataException {
  Component comp=(Component)findBP.findComponent(componentIdentifier,ComponentHandler.getAutHierarchy());
  if (comp != null && comp.isShowing()) {
    Window window=SwingUtilities.getWindowAncestor(comp);
    if (window != null && window.isShowing()) {
      window.toFront();
    }
    return comp;
  }
  throw new ComponentNotManagedException("String_Node_Str" + componentIdentifier.toString() + "String_Node_Str",MessageIDs.E_COMPONENT_NOT_MANAGED);
}

Fixed version (ground truth):
/** 
 * Searchs for the component in the AUT with the given <code>componentIdentifier</code>.
 * @param componentIdentifier the identifier created in object mapping mode
 * @throws IllegalArgumentException if the given identifer is null or <br>the hierarchy is not valid: empty or containing null elements
 * @throws InvalidDataException if the hierarchy in the componentIdentifier does not consist of strings
 * @throws ComponentNotManagedException if no component could be found for the identifier
 * @return the instance of the component of the AUT 
 */
public Component findComponent(IComponentIdentifier componentIdentifier) throws IllegalArgumentException, ComponentNotManagedException, InvalidDataException {
  Component comp=(Component)findBP.findComponent(componentIdentifier,ComponentHandler.getAutHierarchy());
  if (comp != null && comp.isShowing()) {
    Window window=SwingUtilities.getWindowAncestor(comp);
    if (window != null && window.isShowing() && !window.isActive()) {
      window.toFront();
    }
    return comp;
  }
  throw new ComponentNotManagedException("String_Node_Str" + componentIdentifier.toString() + "String_Node_Str",MessageIDs.E_COMPONENT_NOT_MANAGED);
}
Program: 95975
Project: 95975
Buggy source:
/** 
 * Indicates whether there is a problem with moving the given selection. If there is a problem, it is described by the return value.
 * @param selectionList The elements that are to be moved
 * @param problems All problems with moving the given nodes.
 */
private void getMoveProblem(List<INodePO> selectionList,ProblemSet problems){
  for (  INodePO node : selectionList) {
    if (node instanceof IExecTestCasePO) {
      ISpecTestCasePO refTestCase=((IExecTestCasePO)node).getSpecTestCase();
      if (refTestCase != null) {
        Long curProjectId=GeneralStorage.getInstance().getProject().getId();
        if (refTestCase.getParentProjectId().equals(curProjectId)) {
          problems.addProblem(node);
        }
      }
    }
 else {
      getMoveProblem(node.getUnmodifiableNodeList(),problems);
    }
  }
}

Fixed version (ground truth):
/** 
 * Indicates whether there is a problem with moving the given selection.
 * @param selectionList The elements that are to be moved
 * @param problems All problems with moving the given nodes.
 */
private void getMoveProblem(List<INodePO> selectionList,ProblemSet problems){
  Long cProjId=GeneralStorage.getInstance().getProject().getId();
  for (  INodePO node : selectionList) {
    if (node instanceof IExecTestCasePO) {
      ISpecTestCasePO refTestCase=((IExecTestCasePO)node).getSpecTestCase();
      if (!problems.getNodesToMove().contains(refTestCase) && cProjId.equals(refTestCase.getParentProjectId())) {
        problems.getProblems().add(refTestCase);
      }
    }
 else {
      getMoveProblem(node.getUnmodifiableNodeList(),problems);
    }
  }
}
Program: 95976
Project: 95976
Buggy source:
/** 
 * @return List of valid problems.
 */
public List<MoveProblem> getProblems(){
  return m_problems;
}

Fixed version (ground truth):
/** 
 * @return List of valid problems.
 */
public Set<INodePO> getProblems(){
  return m_problems;
}
Program: 95977
Project: 95977
Buggy source:
/** 
 * {@inheritDoc}
 */
public void setEnabled(boolean enabled){
  IProjectPO currentProject=GeneralStorage.getInstance().getProject();
  boolean projectAvailable=currentProject == null ? false : !currentProject.getUsedProjects().isEmpty();
  super.setEnabled(enabled && projectAvailable);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void setEnabled(boolean enabled){
  IProjectPO currentProject=GeneralStorage.getInstance().getProject();
  boolean projectAvailable=currentProject == null ? false : !currentProject.getUsedProjects().isEmpty();
  super.setEnabled(enabled && projectAvailable);
}
Program: 95978
Project: 95978
Buggy source:
/** 
 * Displays the problems for a proposed move operation.
 * @param moveProblems Valid problems with the proposed move operation.
 */
private void showProblems(ProblemSet moveProblems){
  StringBuilder sb=new StringBuilder();
  for (  MoveProblem moveProblem : moveProblems.getProblems()) {
    sb.append(moveProblem.getCause().getName());
    sb.append(StringConstants.NEWLINE);
  }
  ErrorHandlingUtil.createMessageDialog(MessageIDs.I_CANNOT_MOVE_TC,null,new String[]{NLS.bind(Messages.InfoDetailCannotMoveTc,sb.toString())});
}

Fixed version (ground truth):
/** 
 * Displays the problems for a proposed move operation.
 * @param moveProblems Valid problems with the proposed move operation.
 */
private void showProblems(ProblemSet moveProblems){
  StringBuilder sb=new StringBuilder();
  for (  INodePO moveProblem : moveProblems.getProblems()) {
    sb.append(moveProblem.getName());
    sb.append(StringConstants.NEWLINE);
  }
  ErrorHandlingUtil.createMessageDialog(MessageIDs.I_CANNOT_MOVE_TC,null,new String[]{NLS.bind(Messages.InfoDetailCannotMoveTc,sb.toString())});
}
Program: 95980
Project: 95980
Buggy source:
/** 
 * Constructor
 * @param nodesToMove The nodes that are to be moved.
 */
public ProblemSet(List<INodePO> nodesToMove){
  m_nodesToMove=new ArrayList<INodePO>();
  for (  INodePO node : nodesToMove) {
    addCatChildren(node,m_nodesToMove);
  }
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param nodesToMove The nodes that are to be moved.
 */
public ProblemSet(List<INodePO> nodesToMove){
  setNodesToMove(new ArrayList<INodePO>());
  for (  INodePO node : nodesToMove) {
    addCatChildren(node,getNodesToMove());
  }
}
Program: 95981
Project: 95981
Buggy source:
/** 
 * Deletes all selected items unless an error occurs.
 * @param selection The selected items to delete.
 */
private void deleteSelection(IStructuredSelection selection){
  Set<INodePO> set=new HashSet<INodePO>(selection.toList());
  Set<INodePO> topNodesToDelete=new HashSet<INodePO>();
  for (  INodePO node : set) {
    if (!containsParent(set,node)) {
      topNodesToDelete.add(node);
    }
  }
  List<INodePO> nodesToDelete=new ArrayList<INodePO>();
  for (  INodePO node : topNodesToDelete) {
    collectNodesToDelete(nodesToDelete,node);
  }
  Collections.reverse(nodesToDelete);
  List<AbstractCmdHandle> cmds=getDeleteCommands(nodesToDelete);
  if (!cmds.isEmpty()) {
    try {
      MultipleNodePM.getInstance().executeCommands(cmds);
      List<DataChangedEvent> eventList=new ArrayList<DataChangedEvent>();
      for (      INodePO node : topNodesToDelete) {
        eventList.add(new DataChangedEvent(node,DataState.Deleted,UpdateState.all));
      }
      DataEventDispatcher.getInstance().fireDataChangedListener(eventList.toArray(new DataChangedEvent[0]));
    }
 catch (    PMException e) {
      PMExceptionHandler.handlePMExceptionForMasterSession(e);
    }
catch (    ProjectDeletedException e) {
      PMExceptionHandler.handleGDProjectDeletedException();
    }
  }
}

Fixed version (ground truth):
/** 
 * Deletes all selected items unless an error occurs.
 * @param selection The selected items to delete.
 */
private void deleteSelection(IStructuredSelection selection){
  Set<INodePO> set=new HashSet<INodePO>(selection.toList());
  Set<INodePO> topNodesToDelete=new HashSet<INodePO>();
  for (  INodePO node : set) {
    if (!containsParent(set,node)) {
      topNodesToDelete.add(node);
    }
  }
  List<INodePO> nodesToDelete=new ArrayList<INodePO>();
  for (  INodePO node : topNodesToDelete) {
    MultipleNodePM.collectAffectedNodes(nodesToDelete,node);
  }
  Collections.reverse(nodesToDelete);
  List<AbstractCmdHandle> cmds=getDeleteCommands(nodesToDelete);
  if (!cmds.isEmpty()) {
    try {
      MultipleNodePM.getInstance().executeCommands(cmds);
      List<DataChangedEvent> eventList=new ArrayList<DataChangedEvent>();
      for (      INodePO node : topNodesToDelete) {
        eventList.add(new DataChangedEvent(node,DataState.Deleted,UpdateState.all));
      }
      DataEventDispatcher.getInstance().fireDataChangedListener(eventList.toArray(new DataChangedEvent[0]));
    }
 catch (    PMException e) {
      PMExceptionHandler.handlePMExceptionForMasterSession(e);
    }
catch (    ProjectDeletedException e) {
      PMExceptionHandler.handleGDProjectDeletedException();
    }
  }
}
Program: 95982
Project: 95982
Buggy source:
/** 
 * Selects a value from the list of the combobox
 * @param valueList the item(s) which should be (not)selected.
 * @param separator The separator if <code>text</code> is an enumeration of values. Not supported by this implementation class
 * @param operator if regular expressions are used
 * @param searchType Determines where the search begins ("relative" or "absolute")
 */
private void gdSelectValue(String valueList,String separator,String operator,final String searchType){
  String[] values=split(valueList,separator);
  getCBAdapter().select(values,operator,searchType);
}

Fixed version (ground truth):
/** 
 * Selects a value from the list of the combobox
 * @param value The value to select
 * @param operator if regular expressions are used
 * @param searchType Determines where the search begins ("relative" or "absolute")
 */
public void gdSelectValue(String value,String operator,final String searchType){
  getCBAdapter().select(value,operator,searchType);
}
Program: 95983
Project: 95983
Buggy source:
/** 
 * Selects the specified item in the combobox.
 * @param values the values which should be (not) selected
 * @param operator if regular expressions are used
 * @param searchType Determines where the search begins ("relative" or "absolute")
 * @throws StepExecutionException if an error occurs during selecting the item
 * @throws IllegalArgumentException if <code>component</code> or <code>text</code> are null
 */
public void select(final String[] values,String operator,String searchType) throws StepExecutionException, IllegalArgumentException ;

Fixed version (ground truth):
/** 
 * Selects the specified item in the combobox.
 * @param value the value which should be selected
 * @param operator if regular expressions are used
 * @param searchType Determines where the search begins ("relative" or "absolute")
 * @throws StepExecutionException if an error occurs during selecting the item
 * @throws IllegalArgumentException if <code>component</code> or <code>text</code> are null
 */
public void select(final String value,String operator,String searchType) throws StepExecutionException, IllegalArgumentException ;
Program: 95984
Project: 95984
Buggy source:
/** 
 * Selects the specified item in the combobox.
 * @param values the values which should be (not) selected
 * @param operator if regular expressions are used
 * @param searchType Determines where the search begins ("relative" or "absolute")
 * @throws StepExecutionException if an error occurs during selecting the item
 * @throws IllegalArgumentException if <code>component</code> or <code>text</code> are null
 */
public void select(final String[] values,String operator,String searchType) throws StepExecutionException, IllegalArgumentException {
  try {
    for (int i=0; i < values.length; i++) {
      String text=values[i];
      Validate.notNull(text,"String_Node_Str");
    }
    JListAdapter list=new JListAdapter(findJList());
    Integer[] indices=list.findIndicesOfValues(values,operator,searchType);
    Arrays.sort(indices);
    if (indices.length == 0) {
      throw new StepExecutionException("String_Node_Str" + Arrays.asList(values).toString() + "String_Node_Str",EventFactory.createActionError(TestErrorEvent.NOT_FOUND));
    }
    list.clickOnIndex(indices[0],ClickOptions.create().setClickCount(1),getMaxWidth());
  }
 catch (  StepExecutionException e) {
    m_comboBox.hidePopup();
    throw e;
  }
catch (  IllegalArgumentException e) {
    m_comboBox.hidePopup();
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Selects the specified item in the combobox.
 * @param value the value which should be selected
 * @param operator if regular expressions are used
 * @param searchType Determines where the search begins ("relative" or "absolute")
 * @throws StepExecutionException if an error occurs during selecting the item
 * @throws IllegalArgumentException if <code>component</code> or <code>text</code> are null
 */
public void select(final String value,String operator,String searchType) throws StepExecutionException, IllegalArgumentException {
  try {
    Validate.notNull(value,"String_Node_Str");
    JListAdapter list=new JListAdapter(findJList());
    Integer[] indices=list.findIndicesOfValues(new String[]{value},operator,searchType);
    Arrays.sort(indices);
    if (indices.length == 0) {
      throw new StepExecutionException("String_Node_Str" + value + "String_Node_Str",EventFactory.createActionError(TestErrorEvent.NOT_FOUND));
    }
    list.clickOnIndex(indices[0],ClickOptions.create().setClickCount(1),getMaxWidth());
  }
 catch (  StepExecutionException e) {
    m_comboBox.hidePopup();
    throw e;
  }
catch (  IllegalArgumentException e) {
    m_comboBox.hidePopup();
    throw e;
  }
}
Program: 95985
Project: 95985
Buggy source:
/** 
 * {@inheritDoc}
 */
public boolean containsValue(String value,String operator){
  Integer[] indices=null;
  if (operator.equals(MatchUtil.NOT_EQUALS)) {
    indices=findIndicesOfValues(new String[]{value},MatchUtil.EQUALS,CompSystemConstants.SEARCH_TYPE_ABSOLUTE);
    return indices.length == 0;
  }
  indices=findIndicesOfValues(new String[]{value},operator,CompSystemConstants.SEARCH_TYPE_ABSOLUTE);
  return indices.length > 0;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public boolean containsValue(String value,String operator){
  Integer[] indices=null;
  if (operator.equals(MatchUtil.NOT_EQUALS)) {
    indices=findIndicesOfValue(value,MatchUtil.EQUALS,CompSystemConstants.SEARCH_TYPE_ABSOLUTE);
    return indices.length == 0;
  }
  indices=findIndicesOfValue(value,operator,CompSystemConstants.SEARCH_TYPE_ABSOLUTE);
  return indices.length > 0;
}
Program: 95986
Project: 95986
Buggy source:
/** 
 * Use this to handle the Highlighting after a Click.
 * @param implClass IImplementationClass
 * @param highlightColor highlight clolor
 */
protected void highlightClicked(final Object implClass,final Color highlightColor){
  Timer timer=new Timer(REPAINT_DELAY,new ActionListener(){
    public void actionPerformed(    ActionEvent e){
synchronized (getComponentLock()) {
        if (getCurrentComponent() != null && getCurrentComponent().isShowing() && SwingUtilities.getWindowAncestor(getCurrentComponent()) != null && SwingUtilities.getWindowAncestor(getCurrentComponent()).getFocusOwner() != null) {
          ReflectionBP.invokeMethod("String_Node_Str",implClass,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
          setHighLighted(true);
        }
      }
    }
  }
);
  timer.setRepeats(false);
  timer.start();
}

Fixed version (ground truth):
/** 
 * Use this to handle the Highlighting after a Click.
 * @param implClass IImplementationClass
 * @param highlightColor highlight clolor
 */
protected void highlightClicked(final Object implClass,final Color highlightColor){
  Timer timer=new Timer(REPAINT_DELAY,new ActionListener(){
    public void actionPerformed(    ActionEvent e){
synchronized (getComponentLock()) {
        if (getCurrentComponent() != null && getCurrentComponent().isShowing() && SwingUtilities.getWindowAncestor(getCurrentComponent()) != null && SwingUtilities.getWindowAncestor(getCurrentComponent()).getFocusOwner() != null) {
          Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
          ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
          setHighLighted(true);
        }
      }
    }
  }
);
  timer.setRepeats(false);
  timer.start();
}
Program: 95987
Project: 95987
Buggy source:
/** 
 * Handles the High-/Lowlighting.<br> When High-/LowLighting afer a click use highlightClicked.
 * @param source Component
 * @param implClass IImplementationClass
 * @param highlightColor highlight clolor
 * @see AbstractGDAutSwingEventListener#highlightClicked(Object,Color)
 */
protected void highlight(Component source,final Object implClass,final Color highlightColor){
synchronized (getComponentLock()) {
    if (getCurrentComponent() != null && getCurrentComponent() != source) {
      ReflectionBP.invokeMethod("String_Node_Str",implClass,new Class[]{Component.class},new Object[]{getCurrentComponent()});
      setHighLighted(false);
    }
    setCurrentComponent(source);
    Window windowAncestor=SwingUtilities.getWindowAncestor(getCurrentComponent());
    if (windowAncestor != null && windowAncestor.getFocusOwner() != null) {
      ReflectionBP.invokeMethod("String_Node_Str",implClass,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      setHighLighted(true);
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles the High-/Lowlighting.<br> When High-/LowLighting afer a click use highlightClicked.
 * @param source Component
 * @param implClass IImplementationClass
 * @param highlightColor highlight clolor
 * @see AbstractGDAutSwingEventListener#highlightClicked(Object,Color)
 */
protected void highlight(Component source,final Object implClass,final Color highlightColor){
  Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(source);
synchronized (getComponentLock()) {
    if (getCurrentComponent() != null && getCurrentComponent() != source) {
      ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class},new Object[]{getCurrentComponent()});
      setHighLighted(false);
    }
    setCurrentComponent(source);
    Window windowAncestor=SwingUtilities.getWindowAncestor(getCurrentComponent());
    if (windowAncestor != null && windowAncestor.getFocusOwner() != null) {
      ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      setHighLighted(true);
    }
  }
}
Program: 95988
Project: 95988
Buggy source:
public void actionPerformed(ActionEvent e){
synchronized (getComponentLock()) {
    if (getCurrentComponent() != null && getCurrentComponent().isShowing() && SwingUtilities.getWindowAncestor(getCurrentComponent()) != null && SwingUtilities.getWindowAncestor(getCurrentComponent()).getFocusOwner() != null) {
      ReflectionBP.invokeMethod("String_Node_Str",implClass,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      setHighLighted(true);
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
synchronized (getComponentLock()) {
    if (getCurrentComponent() != null && getCurrentComponent().isShowing() && SwingUtilities.getWindowAncestor(getCurrentComponent()) != null && SwingUtilities.getWindowAncestor(getCurrentComponent()).getFocusOwner() != null) {
      Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
      ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      setHighLighted(true);
    }
  }
}
Program: 95989
Project: 95989
Buggy source:
/** 
 * This method is called by the AUTServer AFTER this instance is removed as AWTEventListener for cleaning up purpose. <br> low lights the last hight lighted component.
 */
public void cleanUp(){
synchronized (m_componentLock) {
    if (getCurrentComponent() != null) {
      Object implClass;
      try {
        implClass=AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(m_currentComponent));
        if (implClass != null) {
          ReflectionBP.invokeMethod("String_Node_Str",implClass,new Class[]{Component.class},new Object[]{m_currentComponent});
          setHighLighted(false);
        }
      }
 catch (      UnsupportedComponentException uce) {
        log.warn(uce);
      }
catch (      IllegalArgumentException iae) {
        log.error(iae);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This method is called by the AUTServer AFTER this instance is removed as AWTEventListener for cleaning up purpose. <br> low lights the last hight lighted component.
 */
public void cleanUp(){
synchronized (m_componentLock) {
    if (getCurrentComponent() != null) {
      try {
        Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
        if (adapter != null) {
          ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class},new Object[]{m_currentComponent});
          setHighLighted(false);
        }
      }
 catch (      IllegalArgumentException iae) {
        log.error(iae);
      }
    }
  }
}
Program: 95990
Project: 95990
Buggy source:
/** 
 * highlights a component
 * @param compId Component
 * @return boolean succsessful?
 */
public boolean highlightComponent(IComponentIdentifier compId){
  Object implClass;
  final Color highlightColor=null;
  Component component=null;
  try {
    if (getCurrentComponent() != null) {
      implClass=AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
      if (implClass != null) {
        ReflectionBP.invokeMethod("String_Node_Str",implClass,new Class[]{Component.class},new Object[]{getCurrentComponent()});
        setHighLighted(false);
      }
    }
    component=ComponentHandler.findComponent(compId,false,0);
    if (component != null) {
      setCurrentComponent(component);
      if (getCurrentComponent() != null && getCurrentComponent().isShowing() && getCurrentComponent().isVisible()) {
        implClass=AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
        ReflectionBP.invokeMethod("String_Node_Str",implClass,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
        setHighLighted(true);
        return true;
      }
    }
 else {
      return false;
    }
  }
 catch (  ComponentNotFoundException e) {
    log.warn(e);
  }
catch (  IllegalArgumentException e) {
    log.warn(e);
  }
catch (  UnsupportedComponentException uce) {
    log.warn(uce);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * highlights a component
 * @param compId Component
 * @return boolean succsessful?
 */
public boolean highlightComponent(IComponentIdentifier compId){
  final Color highlightColor=null;
  Component component=null;
  try {
    if (getCurrentComponent() != null) {
      Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
      if (adapter != null) {
        ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class},new Object[]{getCurrentComponent()});
        setHighLighted(false);
      }
    }
    component=ComponentHandler.findComponent(compId,false,0);
    if (component != null) {
      setCurrentComponent(component);
      if (getCurrentComponent() != null && getCurrentComponent().isShowing() && getCurrentComponent().isVisible()) {
        Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
        ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
        setHighLighted(true);
        return true;
      }
    }
 else {
      return false;
    }
  }
 catch (  ComponentNotFoundException e) {
    log.warn(e);
  }
catch (  IllegalArgumentException e) {
    log.warn(e);
  }
  return false;
}
Program: 95991
Project: 95991
Buggy source:
/** 
 * repaints the border
 */
public void update(){
  Object implClass;
  final Color highlightColor=null;
  if (getCurrentComponent() != null) {
    try {
      implClass=AUTServerConfiguration.getInstance().getImplementationClass(getComponentClass(getCurrentComponent()));
      if (implClass != null) {
        ReflectionBP.invokeMethod("String_Node_Str",implClass,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      }
    }
 catch (    UnsupportedComponentException e) {
    }
catch (    IllegalArgumentException e) {
      log.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * repaints the border
 */
public void update(){
  final Color highlightColor=null;
  if (getCurrentComponent() != null) {
    try {
      Object adapter=GUIAdapterFactoryRegistry.getInstance().getAdapter(getCurrentComponent());
      if (adapter != null) {
        ReflectionBP.invokeMethod("String_Node_Str",adapter,new Class[]{Component.class,Color.class},new Object[]{getCurrentComponent(),highlightColor});
      }
    }
 catch (    IllegalArgumentException e) {
      log.error("String_Node_Str",e);
    }
  }
}
Program: 95992
Project: 95992
Buggy source:
public Object run(){
  return getRenderedText(renderer);
}

Fixed version (ground truth):
public void run(){
  HIGHLIGHTER.lowLight(comp);
}
Program: 95994
Project: 95994
Buggy source:
/** 
 * Clicks on a menu item
 * @param robot the robot
 * @param item the menu item
 */
public static void clickMenuItem(IRobot robot,JMenuItem item){
  if (!item.isEnabled()) {
    throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.MENU_ITEM_NOT_ENABLED));
  }
  robot.click(item,null,ClickOptions.create().setClickType(ClickOptions.ClickType.RELEASED).setStepMovement(false));
}

Fixed version (ground truth):
/** 
 * Clicks on a menu item
 * @param robot the robot
 * @param item the menu item
 */
public static void clickMenuItem(IRobot robot,JMenuItem item){
  if (!item.isEnabled()) {
    throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.MENU_ITEM_NOT_ENABLED));
  }
  if (item.getParent() instanceof JPopupMenu && ((JPopupMenu)item.getParent()).getInvoker().getParent() instanceof JMenuBar) {
    robot.click(item,null,ClickOptions.create().setClickType(ClickOptions.ClickType.RELEASED).setFirstHorizontal(true));
  }
 else {
    robot.click(item,null,ClickOptions.create().setClickType(ClickOptions.ClickType.RELEASED));
  }
}
Program: 95997
Project: 95997
Buggy source:
/** 
 * Clicks on a menu item
 * @param robot the robot
 * @param item the menu item
 */
public static void clickMenuItem(IRobot robot,JMenuItem item){
  if (!item.isEnabled()) {
    throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.MENU_ITEM_NOT_ENABLED));
  }
  robot.click(item,null,ClickOptions.create().setClickType(ClickOptions.ClickType.RELEASED));
}

Fixed version (ground truth):
/** 
 * Clicks on a menu item
 * @param robot the robot
 * @param item the menu item
 */
public static void clickMenuItem(IRobot robot,JMenuItem item){
  if (!item.isEnabled()) {
    throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.MENU_ITEM_NOT_ENABLED));
  }
  robot.click(item,null,ClickOptions.create().setClickType(ClickOptions.ClickType.RELEASED).setStepMovement(false));
}
Program: 95998
Project: 95998
Buggy source:
/** 
 * {@inheritDoc}
 */
public void decorate(Object element,IDecoration decoration){
  if (element instanceof TestResultNode) {
    TestResultNode testResult=(TestResultNode)element;
    StringBuilder paramValueBuilder=new StringBuilder();
    for (    TestResultParameter parameter : testResult.getParameters()) {
      paramValueBuilder.append(StringUtils.defaultString(parameter.getValue())).append(SEPARATOR);
    }
    if (paramValueBuilder.length() > 0) {
      int builderLength=paramValueBuilder.length();
      paramValueBuilder.delete(builderLength - SEPARATOR_LEN,builderLength);
      paramValueBuilder.insert(0,"String_Node_Str");
      paramValueBuilder.append("String_Node_Str");
      decoration.addSuffix(paramValueBuilder.toString());
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void decorate(Object element,IDecoration decoration){
  if (element instanceof TestResultNode) {
    TestResultNode testResult=(TestResultNode)element;
    StringBuilder paramValueBuilder=new StringBuilder();
    List<TestResultParameter> parameters=testResult.getParameters();
    for (int index=0; index < parameters.size(); index++) {
      TestResultParameter parameter=parameters.get(index);
      paramValueBuilder.append(StringUtils.defaultString(parameter.getValue())).append(SEPARATOR);
    }
    if (paramValueBuilder.length() > 0) {
      int builderLength=paramValueBuilder.length();
      paramValueBuilder.delete(builderLength - SEPARATOR_LEN,builderLength);
      paramValueBuilder.insert(0,"String_Node_Str");
      paramValueBuilder.append("String_Node_Str");
      decoration.addSuffix(paramValueBuilder.toString());
    }
  }
}