nus-yam/ex-repair huggingface dataset:
Program: 95752
Project: 95752
Buggy source:
/** 
 * validates the argument of no-run option sets default value of no-run option if no argument is given
 * @param runStepValue the value to be validated
 * @return true the given value if it is valid,default value if no argument is given and EXIT_INVALID_ARGUMENT ("invalid argument") if the argument is invalid
 */
public static String validateRunStep(String runStepValue){
  if (StringUtils.isEmpty(runStepValue)) {
    return getDefaultNoRunMode();
  }
  for (  runSteps noRunOptMode : TestExecutionConstants.runSteps.values()) {
    if (noRunOptMode.getStepValue().equals(runStepValue)) {
      return runStepValue;
    }
  }
  return EXIT_INVALID_ARGUMENT;
}

Fixed version (ground truth):
/** 
 * validates the argument of no-run option sets default value of no-run option if no argument is given
 * @param runStepValue the value to be validated
 * @return true the given value if it is valid,default value if no argument is given and EXIT_INVALID_ARGUMENT ("invalid argument") if the argument is invalid
 */
public static String validateRunStep(String runStepValue){
  if (StringUtils.isEmpty(runStepValue)) {
    return getDefaultNoRunMode();
  }
  for (  RunSteps noRunOptMode : TestExecutionConstants.RunSteps.values()) {
    if (noRunOptMode.getStepValue().equals(runStepValue)) {
      return runStepValue;
    }
  }
  return EXIT_INVALID_ARGUMENT;
}
Program: 95753
Project: 95753
Buggy source:
/** 
 * {@inheritDoc}
 */
public Object executeImpl(ExecutionEvent event){
  DirectoryDialog directoryDialog=createDirectoryDialog();
  genPath=directoryDialog.open();
  if (genPath != null) {
    org.eclipse.jubula.client.ui.rcp.utils.Utils.storeLastDirPath(directoryDialog.getFilterPath());
    File directory=new File(genPath);
    if (directory.list().length == 0) {
      InputDialog inputDialog=new InputDialog(getActiveShell(),Messages.InputDialogName,Messages.InputDialogMessage,StringConstants.EMPTY,new PackageNameValidator());
      if (inputDialog.open() == Window.OK) {
        genPackage=inputDialog.getValue();
        IWorkbench workbench=PlatformUI.getWorkbench();
        try {
          workbench.getProgressService().run(true,true,new ConvertProjectOperation());
        }
 catch (        InvocationTargetException|InterruptedException e) {
          LOG.error(Messages.ErrorWhileConverting,e);
        }
      }
    }
 else {
      ErrorHandlingUtil.createMessageDialog(MessageIDs.E_NON_EMPTY_DIRECTORY);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public Object executeImpl(ExecutionEvent event){
  language=WorkingLanguageBP.getInstance().getWorkingLanguage();
  DirectoryDialog directoryDialog=createDirectoryDialog();
  genPath=directoryDialog.open();
  if (genPath != null) {
    org.eclipse.jubula.client.ui.rcp.utils.Utils.storeLastDirPath(directoryDialog.getFilterPath());
    File directory=new File(genPath);
    if (directory.list().length == 0) {
      InputDialog inputDialog=new InputDialog(getActiveShell(),Messages.InputDialogName,Messages.InputDialogMessage,StringConstants.EMPTY,new PackageNameValidator());
      if (inputDialog.open() == Window.OK) {
        genPackage=inputDialog.getValue();
        IWorkbench workbench=PlatformUI.getWorkbench();
        try {
          workbench.getProgressService().run(true,true,new ConvertProjectOperation());
        }
 catch (        InvocationTargetException|InterruptedException e) {
          LOG.error(Messages.ErrorWhileConverting,e);
        }
      }
    }
 else {
      ErrorHandlingUtil.createMessageDialog(MessageIDs.E_NON_EMPTY_DIRECTORY);
    }
  }
  return null;
}
Program: 95755
Project: 95755
Buggy source:
/** 
 * creates the project name field
 * @param composite parent
 * @param withName true if the name field should be created
 */
private void createNameField(Composite composite,boolean withName){
  if (!withName) {
    return;
  }
  GridData gridData=newGridData();
  new Label(composite,SWT.NONE).setText(Messages.SaveProjectAsActionLabel);
  m_projectNameField=new CheckedProjectNameText(composite,SWT.SINGLE | SWT.BORDER);
  gridData=newGridData();
  LayoutUtil.addToolTipAndMaxWidth(gridData,m_projectNameField);
  gridData.widthHint=0;
  gridData.horizontalSpan=3;
  gridData.horizontalAlignment=GridData.FILL;
  m_projectNameField.setLayoutData(gridData);
  m_projectNameField.setText(StringUtils.defaultString(null));
  LayoutUtil.setMaxChar(m_projectNameField,m_length);
  m_projectNameField.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      modifyVersionFieldAction();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * creates the project name field
 * @param composite parent
 * @param withName true if the name field should be created
 */
private void createNameField(Composite composite,boolean withName){
  if (!withName) {
    return;
  }
  GridData gridData=newGridData();
  new Label(composite,SWT.NONE).setText(Messages.SaveProjectAsActionLabel);
  m_projectNameField=new CheckedProjectNameText(composite,SWT.SINGLE | SWT.BORDER);
  gridData=newGridData();
  LayoutUtil.addToolTipAndMaxWidth(gridData,m_projectNameField);
  gridData.widthHint=0;
  gridData.horizontalSpan=3;
  gridData.horizontalAlignment=GridData.FILL;
  m_projectNameField.setLayoutData(gridData);
  m_projectNameField.setText(StringUtils.defaultString(null));
  m_projectNameField.setData(SwtAUTHierarchyConstants.WIDGET_NAME,"String_Node_Str");
  LayoutUtil.setMaxChar(m_projectNameField,m_length);
  m_projectNameField.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      modifyVersionFieldAction();
    }
  }
);
}
Program: 95757
Project: 95757
Buggy source:
/** 
 * Checks all available projects
 * @return list of all projects
 */
private List<IProjectPO> checkAllAvailableProjects(){
  List<IProjectPO> projList=null;
  try {
    projList=ProjectPM.findAllProjects();
    if (projList.isEmpty()) {
      Display.getDefault().asyncExec(new Runnable(){
        public void run(){
          ErrorHandlingUtil.createMessageDialog(MessageIDs.I_NO_PROJECT_IN_DB);
        }
      }
);
      Plugin.stopLongRunning();
    }
 else {
      SortedMap<String,List<String>> projNameToVersionMap=new TreeMap<String,List<String>>();
      for (      IProjectPO proj : projList) {
        String projName=proj.getName();
        String projVersion=proj.getVersionString();
        if (!projNameToVersionMap.containsKey(projName)) {
          projNameToVersionMap.put(projName,new ArrayList<String>());
        }
        projNameToVersionMap.get(projName).add(projVersion);
      }
    }
  }
 catch (  final JBException e) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        ErrorHandlingUtil.createMessageDialog(e,null,null);
      }
    }
);
  }
  return projList;
}

Fixed version (ground truth):
/** 
 * Checks all available projects
 * @return list of all projects
 */
private List<IProjectPO> checkAllAvailableProjects(){
  List<IProjectPO> projList=null;
  try {
    projList=ProjectPM.findAllProjects();
    if (projList.isEmpty()) {
      Display.getDefault().asyncExec(new Runnable(){
        public void run(){
          ErrorHandlingUtil.createMessageDialog(MessageIDs.I_NO_PROJECT_IN_DB);
        }
      }
);
      Plugin.stopLongRunning();
    }
 else {
      SortedMap<String,List<String>> projNameToVersionMap=new TreeMap<String,List<String>>();
      for (      IProjectPO proj : projList) {
        String projName=proj.getName();
        String projVersion=proj.getVersionString();
        if (!StringUtils.isBlank(projName) && !projNameToVersionMap.containsKey(projName)) {
          projNameToVersionMap.put(projName,new ArrayList<String>());
        }
        projNameToVersionMap.get(projName).add(projVersion);
      }
    }
  }
 catch (  final JBException e) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        ErrorHandlingUtil.createMessageDialog(e,null,null);
      }
    }
);
  }
  return projList;
}
Program: 95758
Project: 95758
Buggy source:
/** 
 * Opens the dialog to change the project name
 * @return the dialog
 */
private VersionDialog openInputDialog(){
  VersionDialog dialog=new VersionDialog(getActiveShell(),Messages.SaveProjectAsActionTitle,Messages.SaveProjectAsActionMessage,IconConstants.BIG_PROJECT_STRING,Messages.SaveProjectAsActionShellTitle,true){
    /** 
 * {@inheritDoc}
 */
    protected boolean isInputAllowed(){
      final String newProjectName=getProjectNameFieldValue();
      boolean isInputAllowed=true;
      if (!ProjectNameBP.isValidProjectName(newProjectName,true)) {
        setErrorMessage(Messages.SaveProjectAsActionInvalidName);
        isInputAllowed=false;
      }
      if (ProjectPM.doesProjectNameExist(newProjectName)) {
        setErrorMessage(Messages.SaveProjectAsActionDoubleOrInvalidName);
        isInputAllowed=false;
      }
      return isInputAllowed;
    }
    /** 
 * {@inheritDoc}
 */
    protected void okPressed(){
      if (ProjectPM.doesProjectNameExist(getProjectNameFieldValue())) {
        ErrorHandlingUtil.createMessageDialog(MessageIDs.E_PROJECTNAME_ALREADY_EXISTS,new Object[]{getProjectNameFieldValue()},null);
        return;
      }
      super.okPressed();
    }
  }
;
  dialog.setHelpAvailable(true);
  dialog.create();
  DialogUtils.setWidgetNameForModalDialog(dialog);
  Plugin.getHelpSystem().setHelp(dialog.getShell(),ContextHelpIds.DIALOG_PROJECT_SAVEAS);
  dialog.open();
  return dialog;
}

Fixed version (ground truth):
/** 
 * Opens the dialog to change the project name
 * @return the dialog
 */
private VersionDialog openInputDialog(){
  VersionDialog dialog=new VersionDialog(getActiveShell(),Messages.SaveProjectAsActionTitle,Messages.SaveProjectAsActionMessage,IconConstants.BIG_PROJECT_STRING,Messages.SaveProjectAsActionShellTitle,true){
    /** 
 * {@inheritDoc}
 */
    protected boolean isInputAllowed(){
      final String newProjectName=getProjectNameFieldValue();
      boolean isInputAllowed=true;
      if (StringUtils.isBlank(newProjectName) || !ProjectNameBP.isValidProjectName(newProjectName,true)) {
        setErrorMessage(Messages.SaveProjectAsActionInvalidName);
        isInputAllowed=false;
      }
      if (ProjectPM.doesProjectNameExist(newProjectName)) {
        setErrorMessage(Messages.SaveProjectAsActionDoubleOrInvalidName);
        isInputAllowed=false;
      }
      return isInputAllowed;
    }
    /** 
 * {@inheritDoc}
 */
    protected void okPressed(){
      String newProjectName=getProjectNameFieldValue();
      if (ProjectPM.doesProjectNameExist(newProjectName) || StringUtils.isBlank(newProjectName)) {
        ErrorHandlingUtil.createMessageDialog(MessageIDs.E_PROJECTNAME_ALREADY_EXISTS,new Object[]{getProjectNameFieldValue()},null);
        return;
      }
      super.okPressed();
    }
  }
;
  dialog.setHelpAvailable(true);
  dialog.create();
  DialogUtils.setWidgetNameForModalDialog(dialog);
  Plugin.getHelpSystem().setHelp(dialog.getShell(),ContextHelpIds.DIALOG_PROJECT_SAVEAS);
  dialog.open();
  return dialog;
}
Program: 95759
Project: 95759
Buggy source:
/** 
 * {@inheritDoc}
 */
protected void okPressed(){
  if (ProjectPM.doesProjectNameExist(getProjectNameFieldValue())) {
    ErrorHandlingUtil.createMessageDialog(MessageIDs.E_PROJECTNAME_ALREADY_EXISTS,new Object[]{getProjectNameFieldValue()},null);
    return;
  }
  super.okPressed();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
protected void okPressed(){
  String newProjectName=getProjectNameFieldValue();
  if (ProjectPM.doesProjectNameExist(newProjectName) || StringUtils.isBlank(newProjectName)) {
    ErrorHandlingUtil.createMessageDialog(MessageIDs.E_PROJECTNAME_ALREADY_EXISTS,new Object[]{getProjectNameFieldValue()},null);
    return;
  }
  super.okPressed();
}
Program: 95760
Project: 95760
Buggy source:
/** 
 * {@inheritDoc}
 */
protected boolean isInputAllowed(){
  final String newProjectName=getProjectNameFieldValue();
  boolean isInputAllowed=true;
  if (!ProjectNameBP.isValidProjectName(newProjectName,true)) {
    setErrorMessage(Messages.SaveProjectAsActionInvalidName);
    isInputAllowed=false;
  }
  if (ProjectPM.doesProjectNameExist(newProjectName)) {
    setErrorMessage(Messages.SaveProjectAsActionDoubleOrInvalidName);
    isInputAllowed=false;
  }
  return isInputAllowed;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
protected boolean isInputAllowed(){
  final String newProjectName=getProjectNameFieldValue();
  boolean isInputAllowed=true;
  if (StringUtils.isBlank(newProjectName) || !ProjectNameBP.isValidProjectName(newProjectName,true)) {
    setErrorMessage(Messages.SaveProjectAsActionInvalidName);
    isInputAllowed=false;
  }
  if (ProjectPM.doesProjectNameExist(newProjectName)) {
    setErrorMessage(Messages.SaveProjectAsActionDoubleOrInvalidName);
    isInputAllowed=false;
  }
  return isInputAllowed;
}
Program: 95761
Project: 95761
Buggy source:
/** 
 * @param graphicsComponent The graphics component the key code is typed in, may be null
 * @param keycode The key code.
 * @param isUpperCase Boolean whether character is upper case.
 */
public void keyType(Object graphicsComponent,int keycode,boolean isUpperCase) throws RobotException {
  try {
    InterceptorOptions options=new InterceptorOptions(new long[]{AWTEvent.KEY_EVENT_MASK});
    IRobotEventConfirmer confirmer=m_interceptor.intercept(options);
    try {
      if (isUpperCase) {
        m_robot.keyPress(java.awt.event.KeyEvent.VK_SHIFT);
      }
      m_robot.keyPress(keycode);
    }
  finally {
      m_robot.keyRelease(keycode);
      if (isUpperCase) {
        m_robot.keyRelease(java.awt.event.KeyEvent.VK_SHIFT);
      }
    }
    confirmer.waitToConfirm(graphicsComponent,new KeyJavaFXEventMatcher(KeyEvent.KEY_RELEASED));
  }
 catch (  IllegalArgumentException e) {
    throw new RobotException(e);
  }
}

Fixed version (ground truth):
/** 
 * @param graphicsComponent The graphics component the key code is typed in, may be null
 * @param keycode The key code.
 * @param isUpperCase Boolean whether character is upper case.
 */
public void keyType(final Object graphicsComponent,final int keycode,final boolean isUpperCase) throws RobotException {
  try {
    InterceptorOptions options=new InterceptorOptions(new long[]{AWTEvent.KEY_EVENT_MASK});
    IRobotEventConfirmer confirmer=m_interceptor.intercept(options);
    EventTarget target=(EventTarget)graphicsComponent;
    if (target == null) {
      target=CurrentStages.getfocusStage();
    }
    Event.fireEvent(target,new KeyEvent(KeyEvent.KEY_TYPED,"String_Node_Str",KeyCodeMap.valueOf(keycode).getName(),KeyCodeMap.valueOf(keycode),isUpperCase,false,false,false));
    confirmer.waitToConfirm(graphicsComponent,new KeyJavaFXEventMatcher(KeyEvent.KEY_TYPED));
  }
 catch (  IllegalArgumentException e) {
    throw new RobotException(e);
  }
}
Program: 95762
Project: 95762
Buggy source:
/** 
 * Searches the hierarchy-map for components that are assignable from the given type
 * @param type the type to look for
 * @param < T > component type
 * @return List
 */
public static <T>List<? extends T> getAssignableFrom(Class<T> type){
  Set<JavaFXComponent> keys=(Set<JavaFXComponent>)hierarchy.getHierarchyMap().keySet();
  List<T> result=new ArrayList<T>();
  for (  JavaFXComponent object : keys) {
    if (type.isAssignableFrom(object.getRealComponentType())) {
      result.add(type.cast(object.getRealComponent()));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Searches the hierarchy-map (in the JavaFX-Thread) for components that are assignable from the given type
 * @param type the type to look for
 * @param < T > component type
 * @return List
 */
public static <T>List<? extends T> getAssignableFrom(final Class<T> type){
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<List<? extends T>>(){
    @Override public List<? extends T> call() throws Exception {
      Set<JavaFXComponent> keys=(Set<JavaFXComponent>)hierarchy.getHierarchyMap().keySet();
      List<T> result=new ArrayList<T>();
      for (      JavaFXComponent object : keys) {
        if (type.isAssignableFrom(object.getRealComponentType())) {
          result.add(type.cast(object.getRealComponent()));
        }
      }
      return result;
    }
  }
);
}
Program: 95763
Project: 95763
Buggy source:
/** 
 * {@inheritDoc}
 */
public Rectangle getBoundsAt(final int index){
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Rectangle>(){
    public Rectangle call(){
      return NodeBounds.getRelativeBounds(getRealComponent().getPanes().get(index),getRealComponent());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public Rectangle getBoundsAt(final int index){
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Rectangle>(){
    public Rectangle call(){
      getRealComponent().layout();
      return NodeBounds.getRelativeBounds(getRealComponent().getPanes().get(index),getRealComponent());
    }
  }
);
}
Program: 95765
Project: 95765
Buggy source:
/** 
 * Checks for uniqueness of <code>name</code> for the components in <code>parent</code>.<br> If parent is null every name is unique, a null name is NEVER unique. If both parameters are null, false is returned. <br>
 * @param parent the hierarchy container containing the components which are checked.
 * @param name the name to check
 * @param container The component for which the name is being checked.
 * @return true if the name is treated as unique, false otherwise.
 */
protected boolean isUniqueName(JavaFXHierarchyContainer parent,String name,JavaFXHierarchyContainer container){
  if (name == null) {
    return false;
  }
  if (parent == null) {
    return true;
  }
  List<JavaFXHierarchyContainer> compIDs=parent.getContainerList();
  for (  JavaFXHierarchyContainer childContainer : compIDs) {
    String childName=childContainer.getName();
    if (name.equals(childName) && childContainer != container) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks for uniqueness of given name using the given list
 * @param name the name to check
 * @param otherNames the list with the names
 * @return true or false
 */
protected boolean isUniqueName(String name,List<String> otherNames){
  if (name == null || otherNames == null) {
    return false;
  }
 else   if (otherNames.isEmpty()) {
    return true;
  }
  return !otherNames.contains(name);
}
Program: 95768
Project: 95768
Buggy source:
@Override public String getText(){
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<String>(){
    @Override public String call() throws Exception {
      Object value=getRealComponent().getValue();
      if (value == null) {
        return null;
      }
      return value.toString();
    }
  }
);
}

Fixed version (ground truth):
@Override public String getText(){
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<String>(){
    @Override public String call() throws Exception {
      ObservableList<Node> children=getRealComponent().getChildrenUnmodifiable();
      ListCell text=null;
      for (      Node node : children) {
        if (node instanceof ListCell) {
          text=(ListCell)node;
        }
      }
      if (text != null) {
        return text.getText();
      }
      return null;
    }
  }
);
}
Program: 95769
Project: 95769
Buggy source:
/** 
 * Gets the index path for a given column 
 * @param column the column
 * @param table the table of the column
 * @return the index path
 */
private String getColumnPath(TableColumnBase column,TableView table){
  String colPath="String_Node_Str";
  TableColumnBase nxtColumn=column;
  while (nxtColumn.getParentColumn() != null) {
    colPath=TestDataConstants.PATH_CHAR_DEFAULT + (nxtColumn.getParentColumn().getColumns().indexOf(nxtColumn) + 1) + colPath;
    nxtColumn=nxtColumn.getParentColumn();
  }
  colPath=(table.getColumns().indexOf(nxtColumn) + 1) + colPath;
  return colPath;
}

Fixed version (ground truth):
/** 
 * Gets the index path for a given column 
 * @param column the column
 * @param table the table of the column
 * @return the index path
 */
private String getColumnPath(TableColumnBase column,TableView table){
  String colPath="String_Node_Str";
  TableColumnBase nxtColumn=column;
  while (nxtColumn.getParentColumn() != null) {
    colPath=String.valueOf(TestDataConstants.PATH_CHAR_DEFAULT).concat(String.valueOf((nxtColumn.getParentColumn().getColumns().indexOf(nxtColumn) + 1) + colPath));
    nxtColumn=nxtColumn.getParentColumn();
  }
  colPath=(table.getColumns().indexOf(nxtColumn) + 1) + colPath;
  return colPath;
}
Program: 95770
Project: 95770
Buggy source:
/** 
 * Returns the internal index of the first column which contains the given value CALL IN JAVAFX-THREAD!
 * @param value the value
 * @param operator the operator
 * @param searchType the searchType
 * @param adapter the adapter class
 * @param implRow the row
 * @return String with the column path or null
 */
private String getColumnByValue(final String value,final String operator,final String searchType,final ITableComponent adapter,final int implRow){
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<String>(){
    @Override public String call() throws Exception {
      final int columnCount=adapter.getColumnCount();
      if (columnCount > 0) {
        int startIndex=getStartingColIndex(searchType);
        List<TableColumn> columns=((TableView)getRealComponent()).getVisibleLeafColumns();
        for (int i=startIndex; i < columns.size(); i++) {
          TableColumn column=columns.get(i);
          int index=adapter.getColumnFromString(getColumnPath(column,(TableView)getRealComponent()),"String_Node_Str");
          String cellValue=adapter.getCellText(implRow,index);
          if (MatchUtil.getInstance().match(cellValue,value,operator)) {
            return getColumnPath(column,(TableView)getRealComponent());
          }
        }
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Returns the internal index of the first column which contains the given value CALL IN JAVAFX-THREAD!
 * @param value the value
 * @param operator the operator
 * @param searchType the searchType
 * @param adapter the adapter class
 * @param implRow the row
 * @return String with the column path or null
 */
private String getColumnByValue(final String value,final String operator,final String searchType,final ITableComponent adapter,final int implRow){
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<String>(){
    @Override public String call(){
      final int columnCount=adapter.getColumnCount();
      if (columnCount > 0) {
        int startIndex=getStartingColIndex(searchType) - 1;
        List<TableColumn> columns=((TableView)getRealComponent()).getVisibleLeafColumns();
        for (int i=startIndex; i < columns.size(); i++) {
          TableColumn column=columns.get(i);
          int index=adapter.getColumnFromString(getColumnPath(column,(TableView)getRealComponent()),"String_Node_Str");
          String cellValue=adapter.getCellText(implRow,index);
          if (MatchUtil.getInstance().match(cellValue,value,operator)) {
            return getColumnPath(column,(TableView)getRealComponent());
          }
        }
      }
      return null;
    }
  }
);
}
Program: 95771
Project: 95771
Buggy source:
/** 
 * @param searchType Determines column where the search begins ("relative" or "absolute")
 * @return The index from which to begin a search, based on the search typeand (if appropriate) the currently selected cell.
 */
private int getStartingColIndex(String searchType){
  int startingIndex=0;
  if (searchType.equalsIgnoreCase(CompSystemConstants.SEARCH_TYPE_RELATIVE)) {
    startingIndex=((ITableComponent)getComponent()).getSelectedCell().getCol() + 1;
  }
  return startingIndex;
}

Fixed version (ground truth):
/** 
 * @param searchType Determines column where the search begins ("relative" or "absolute")
 * @return The index from which to begin a search, based on the search typeand (if appropriate) the currently selected cell.
 */
private int getStartingColIndex(String searchType){
  int startingIndex=0;
  if (searchType.equalsIgnoreCase(CompSystemConstants.SEARCH_TYPE_RELATIVE)) {
    Cell c=((ITableComponent)getComponent()).getSelectedCell();
    if (c == null) {
      throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
    }
    startingIndex=c.getCol() + 1;
  }
  return startingIndex;
}
Program: 95772
Project: 95772
Buggy source:
@Override public Cell getSelectedCell() throws StepExecutionException {
  Cell result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Cell>(){
    @Override public Cell call() throws Exception {
      ObservableList list=getRealComponent().getSelectionModel().getSelectedCells();
      TableView table=getRealComponent();
      if (list.size() > 0) {
        TablePosition pos=null;
        for (        Object object : list) {
          TablePosition curr=(TablePosition)object;
          if (curr.getRow() == table.getSelectionModel().getSelectedIndex()) {
            pos=curr;
            break;
          }
        }
        if (pos != null) {
          return new Cell(pos.getRow(),pos.getColumn());
        }
      }
      throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
    }
  }
);
  return result;
}

Fixed version (ground truth):
@Override public Cell getSelectedCell() throws StepExecutionException {
  Cell result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Cell>(){
    @Override public Cell call() throws StepExecutionException {
      TableView table=getRealComponent();
      ObservableList list=table.getSelectionModel().getSelectedCells();
      if (list.size() > 0) {
        TablePosition pos=null;
        for (        Object object : list) {
          TablePosition curr=(TablePosition)object;
          if (curr.getRow() == table.getSelectionModel().getSelectedIndex()) {
            pos=curr;
            break;
          }
        }
        if (pos != null) {
          return new Cell(pos.getRow(),pos.getColumn());
        }
      }
      throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
    }
  }
);
  return result;
}
Program: 95773
Project: 95773
Buggy source:
@Override public String getCellText(final int row,final int column){
  String result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<String>(){
    @Override public String call() throws Exception {
      TableView<?> table=getRealComponent();
      TableColumn col=table.getVisibleLeafColumn(column);
      table.scrollTo(row);
      table.scrollToColumn(col);
      table.layout();
      List<? extends TableCell> tCells=ComponentHandler.getAssignableFrom(TableCell.class);
      for (      TableCell<?,?> cell : tCells) {
        if (cell.getIndex() == row && cell.getTableColumn() == col && cell.getTableView() == table) {
          String txt=cell.getText();
          if (txt == null && cell instanceof TextFieldTableCell && cell.isEditing()) {
            TextField f=(TextField)cell.getGraphic();
            txt=f.getText();
          }
          return txt;
        }
      }
      return null;
    }
  }
);
  return result;
}

Fixed version (ground truth):
@Override public String getCellText(final int row,final int column){
  String result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<String>(){
    @Override public String call() throws Exception {
      TableView<?> table=getRealComponent();
      TableColumn col=null;
      if (m_columns.size() == 0) {
        col=table.getVisibleLeafColumn(column);
      }
 else {
        col=m_columns.get(column);
      }
      table.scrollTo(row);
      table.scrollToColumn(col);
      table.layout();
      List<? extends TableCell> tCells=ComponentHandler.getAssignableFrom(TableCell.class);
      for (      TableCell<?,?> cell : tCells) {
        if (cell.getIndex() == row && cell.getTableColumn() == col && cell.getTableView() == table) {
          String txt=cell.getText();
          if (txt == null && cell instanceof TextFieldTableCell && cell.isEditing()) {
            TextField f=(TextField)cell.getGraphic();
            txt=f.getText();
          }
          return txt;
        }
      }
      return null;
    }
  }
);
  return result;
}
Program: 95774
Project: 95774
Buggy source:
@Override public Rectangle getHeaderBounds(final int column){
  Rectangle result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Rectangle>(){
    @Override public Rectangle call() throws Exception {
      TableView<?> table=getRealComponent();
      TableColumn col;
      if (m_columns.size() > 0) {
        col=m_columns.get(column);
      }
      col=getRealComponent().getVisibleLeafColumn(column);
      table.scrollToColumn(col);
      table.layout();
      Parent headerRow=(Parent)table.lookup("String_Node_Str");
      Set<Node> columnHeaders=headerRow.lookupAll("String_Node_Str");
      Point2D parentPos=table.localToScreen(0,0);
      for (      Node n : columnHeaders) {
        TableColumnHeader colH=(TableColumnHeader)n;
        if (colH.getTableColumn().equals(col)) {
          Bounds b=n.getBoundsInParent();
          Point2D pos=n.localToScreen(0,0);
          return new Rectangle(Rounding.round(pos.getX() - parentPos.getX()),Rounding.round(pos.getY() - parentPos.getY()),Rounding.round(b.getWidth()),Rounding.round(b.getHeight()));
        }
      }
      return null;
    }
  }
);
  return result;
}

Fixed version (ground truth):
@Override public Rectangle getHeaderBounds(final int column){
  Rectangle result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Rectangle>(){
    @Override public Rectangle call() throws Exception {
      TableView<?> table=getRealComponent();
      TableColumn col;
      if (m_columns.size() > 0) {
        col=m_columns.get(column);
      }
 else {
        col=getRealComponent().getVisibleLeafColumn(column);
      }
      table.scrollToColumn(col);
      table.layout();
      Parent headerRow=(Parent)table.lookup("String_Node_Str");
      Set<Node> columnHeaders=headerRow.lookupAll("String_Node_Str");
      Point2D parentPos=table.localToScreen(0,0);
      for (      Node n : columnHeaders) {
        TableColumnHeader colH=(TableColumnHeader)n;
        if (colH.getTableColumn().equals(col)) {
          Bounds b=n.getBoundsInParent();
          Point2D pos=n.localToScreen(0,0);
          return new Rectangle(Rounding.round(pos.getX() - parentPos.getX()),Rounding.round(pos.getY() - parentPos.getY()),Rounding.round(b.getWidth()),Rounding.round(b.getHeight()));
        }
      }
      return null;
    }
  }
);
  return result;
}
Program: 95775
Project: 95775
Buggy source:
@Override public boolean isCellEditable(final int row,final int column){
  boolean result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      TableView<?> table=getRealComponent();
      if (table.isEditable()) {
        TableColumn col=table.getVisibleLeafColumn(column);
        if (col.isEditable()) {
          table.scrollTo(row);
          table.scrollToColumn(col);
          table.layout();
          List<? extends TableCell> tCells=ComponentHandler.getAssignableFrom(TableCell.class);
          for (          TableCell<?,?> cell : tCells) {
            if (cell.getIndex() == row && cell.getTableColumn() == col && cell.getTableView() == table) {
              return cell.isEditable();
            }
          }
        }
      }
      return false;
    }
  }
);
  return result;
}

Fixed version (ground truth):
@Override public boolean isCellEditable(final int row,final int column){
  boolean result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      TableView<?> table=getRealComponent();
      if (table.isEditable()) {
        TableColumn col=null;
        if (m_columns.size() == 0) {
          col=table.getVisibleLeafColumn(column);
        }
 else {
          col=m_columns.get(column);
        }
        if (col.isEditable()) {
          table.scrollTo(row);
          table.scrollToColumn(col);
          table.layout();
          List<? extends TableCell> tCells=ComponentHandler.getAssignableFrom(TableCell.class);
          for (          TableCell<?,?> cell : tCells) {
            if (cell.getIndex() == row && cell.getTableColumn() == col && cell.getTableView() == table) {
              return cell.isEditable();
            }
          }
        }
      }
      return false;
    }
  }
);
  return result;
}
Program: 95777
Project: 95777
Buggy source:
@Override public Rectangle scrollCellToVisible(final int row,final int column) throws StepExecutionException {
  Rectangle result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Rectangle>(){
    @Override public Rectangle call() throws Exception {
      TableView<?> table=getRealComponent();
      TableColumn col=table.getVisibleLeafColumn(column);
      table.scrollTo(row);
      table.scrollToColumn(col);
      table.layout();
      List<? extends TableCell> tCells=ComponentHandler.getAssignableFrom(TableCell.class);
      for (      TableCell<?,?> cell : tCells) {
        if (cell.getIndex() == row && cell.getTableColumn() == col && cell.getTableView() == table) {
          Bounds b=cell.getBoundsInParent();
          Point2D pos=cell.localToScreen(0,0);
          Point2D parentPos=table.localToScreen(0,0);
          return new Rectangle(Rounding.round(pos.getX() - parentPos.getX()),Rounding.round(pos.getY() - parentPos.getY()),Rounding.round(b.getWidth()),Rounding.round(b.getHeight()));
        }
      }
      return null;
    }
  }
);
  return result;
}

Fixed version (ground truth):
@Override public Rectangle scrollCellToVisible(final int row,final int column) throws StepExecutionException {
  Rectangle result=EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Rectangle>(){
    @Override public Rectangle call() throws Exception {
      TableView<?> table=getRealComponent();
      TableColumn col=null;
      if (m_columns.size() == 0) {
        col=table.getVisibleLeafColumn(column);
      }
 else {
        col=m_columns.get(column);
      }
      table.scrollTo(row);
      table.scrollToColumn(col);
      table.layout();
      List<? extends TableCell> tCells=ComponentHandler.getAssignableFrom(TableCell.class);
      for (      TableCell<?,?> cell : tCells) {
        if (cell.getIndex() == row && cell.getTableColumn() == col && cell.getTableView() == table) {
          Bounds b=cell.getBoundsInParent();
          Point2D pos=cell.localToScreen(0,0);
          Point2D parentPos=table.localToScreen(0,0);
          return new Rectangle(Rounding.round(pos.getX() - parentPos.getX()),Rounding.round(pos.getY() - parentPos.getY()),Rounding.round(b.getWidth()),Rounding.round(b.getHeight()));
        }
      }
      return null;
    }
  }
);
  return result;
}
Program: 95778
Project: 95778
Buggy source:
/** 
 * @param searchType Determines column where the search begins ("relative" or "absolute")
 * @return The index from which to begin a search, based on the search typeand (if appropriate) the currently selected cell.
 */
private int getStartingColIndex(String searchType){
  int startingIndex=0;
  if (searchType.equalsIgnoreCase(CompSystemConstants.SEARCH_TYPE_RELATIVE)) {
    Cell c=((ITableComponent)getComponent()).getSelectedCell();
    if (c == null) {
      throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
    }
    startingIndex=c.getCol() + 1;
  }
  return startingIndex;
}

Fixed version (ground truth):
/** 
 * @param searchType Determines column where the search begins ("relative" or "absolute")
 * @return The index from which to begin a search, based on the search typeand (if appropriate) the currently selected cell.
 */
private int getStartingColIndex(String searchType){
  int startingIndex=0;
  if (searchType.equalsIgnoreCase(CompSystemConstants.SEARCH_TYPE_RELATIVE)) {
    Cell c=((ITableComponent)getComponent()).getSelectedCell();
    if (c == null) {
      throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.NO_SELECTION));
    }
    startingIndex=c.getCol();
  }
  return startingIndex + 1;
}
Program: 95779
Project: 95779
Buggy source:
/** 
 * @param exception -
 * @param stackTraceArray -
 * @return boolean
 */
private boolean checkStackTrace(Throwable exception,StackTraceElement[] stackTraceArray){
  for (int i=0; i < stackTraceArray.length; ++i) {
    String className=stackTraceArray[i].getClassName();
    if ((exception instanceof IllegalArgumentException) && KeySequence.class.getName().equals(className)) {
      return false;
    }
 else     if ((exception instanceof IllegalArgumentException) && stackTraceArray[i].toString().contains("String_Node_Str")) {
      return false;
    }
 else     if ((exception instanceof ClassCastException) && stackTraceArray[i].toString().contains("String_Node_Str")) {
      return false;
    }
 else     if ((exception instanceof NullPointerException) && KeySequenceText.class.getName().equals(className)) {
      return false;
    }
 else     if ((exception instanceof NullPointerException) && className != null && className.startsWith(ConsoleView.class.getName())) {
      return false;
    }
 else     if ((exception instanceof NullPointerException) && Plugin.isGEFException(exception)) {
      return false;
    }
 else     if ((exception instanceof NullPointerException) && Plugin.isRCPException(exception)) {
      return false;
    }
 else     if (exception instanceof NumberFormatException && IPageLayout.ID_PROBLEM_VIEW.equals(getActivePartId())) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @param exception -
 * @param stackTraceArray -
 * @return boolean
 */
private boolean checkStackTrace(Throwable exception,StackTraceElement[] stackTraceArray){
  for (int i=0; i < stackTraceArray.length; ++i) {
    final StackTraceElement stackTraceElement=stackTraceArray[i];
    String className=stackTraceElement.getClassName();
    if ((exception instanceof IllegalArgumentException) && KeySequence.class.getName().equals(className)) {
      return false;
    }
 else     if (stackTraceElement.toString().contains("String_Node_Str")) {
      if ((exception instanceof IllegalArgumentException) || (exception instanceof ClassCastException) || (exception instanceof ConcurrentModificationException)) {
        return false;
      }
    }
 else     if ((exception instanceof NullPointerException) && KeySequenceText.class.getName().equals(className)) {
      return false;
    }
 else     if ((exception instanceof NullPointerException) && className != null && className.startsWith(ConsoleView.class.getName())) {
      return false;
    }
 else     if ((exception instanceof NullPointerException) && Plugin.isGEFException(exception)) {
      return false;
    }
 else     if ((exception instanceof NullPointerException) && Plugin.isRCPException(exception)) {
      return false;
    }
 else     if (exception instanceof NumberFormatException && IPageLayout.ID_PROBLEM_VIEW.equals(getActivePartId())) {
      return false;
    }
  }
  return true;
}
Program: 95780
Project: 95780
Buggy source:
/** 
 * {@inheritDoc}
 */
public int compare(Viewer viewer,Object e1,Object e2){
  if (isOnlyFirstObjectInstanceOfClass(e1,e2,ICategoryPO.class) || isOnlyFirstObjectInstanceOfClass(e1,e2,IReusedProjectPO.class)) {
    return -1;
  }
  if (isOnlyFirstObjectInstanceOfClass(e2,e1,ICategoryPO.class) || isOnlyFirstObjectInstanceOfClass(e2,e1,IReusedProjectPO.class)) {
    return 1;
  }
  if (isOnlyFirstObjectInstanceOfClass(e1,e2,IEventExecTestCasePO.class)) {
    return -1;
  }
  if (isOnlyFirstObjectInstanceOfClass(e2,e1,IEventExecTestCasePO.class)) {
    return 1;
  }
  if (e1 instanceof IExecTestCasePO || e2 instanceof IExecTestCasePO || e1 instanceof ICapPO|| e2 instanceof ICapPO|| e1 instanceof IRefTestSuitePO|| e2 instanceof IRefTestSuitePO) {
    return 0;
  }
  return super.compare(viewer,e1,e2);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public int compare(Viewer viewer,Object e1,Object e2){
  List<Class<?>> preferredTypes=new ArrayList<>(3);
  preferredTypes.add(IReusedProjectPO.class);
  preferredTypes.add(ICategoryPO.class);
  preferredTypes.add(IEventExecTestCasePO.class);
  for (  Class c : preferredTypes) {
    if (isOnlyFirstObjectInstanceOfClass(e1,e2,c)) {
      return -1;
    }
    if (isOnlyFirstObjectInstanceOfClass(e2,e1,c)) {
      return 1;
    }
  }
  if (e1 instanceof IExecTestCasePO || e2 instanceof IExecTestCasePO || e1 instanceof ICapPO|| e2 instanceof ICapPO|| e1 instanceof IRefTestSuitePO|| e2 instanceof IRefTestSuitePO) {
    return 0;
  }
  return super.compare(viewer,e1,e2);
}
Program: 95781
Project: 95781
Buggy source:
/** 
 * @param specTcGuid The GUID of the reused test case.
 * @param parentProjectIds All returned test cases will have one of these astheir project parent ID.
 * @param s The session into which the test cases will be loaded.
 * @return list of test cases.
 */
@SuppressWarnings("String_Node_Str") private static synchronized List<IExecTestCasePO> getExecTestCasesFor(String specTcGuid,List<Long> parentProjectIds,EntityManager s){
  StringBuffer queryBuffer=new StringBuffer("String_Node_Str");
  for (  long id : parentProjectIds) {
    queryBuffer.append("String_Node_Str" + id + "String_Node_Str");
  }
  queryBuffer.delete(queryBuffer.length() - 4,queryBuffer.length());
  queryBuffer.append("String_Node_Str");
  Query q=s.createQuery(queryBuffer.toString());
  q.setParameter("String_Node_Str",specTcGuid);
  List<IExecTestCasePO> execTcList=q.getResultList();
  return execTcList;
}

Fixed version (ground truth):
/** 
 * @param specTcGuid The GUID of the reused test case.
 * @param parentProjectIds All returned test cases will have one of these astheir project parent ID.
 * @param s The session into which the test cases will be loaded.
 * @return list of test cases.
 */
@SuppressWarnings("String_Node_Str") private static synchronized List<IExecTestCasePO> getExecTestCasesFor(String specTcGuid,List<Long> parentProjectIds,EntityManager s){
  StringBuffer queryBuffer=new StringBuffer("String_Node_Str");
  Query q=s.createQuery(queryBuffer.toString());
  q.setParameter("String_Node_Str",specTcGuid);
  q.setParameter("String_Node_Str",parentProjectIds);
  List<IExecTestCasePO> execTcList=q.getResultList();
  return execTcList;
}
Program: 95782
Project: 95782
Buggy source:
/** 
 * @param tsGuid The GUID of the reused test suite.
 * @param parentProjectIds All returned test suites will have one of these astheir project parent ID.
 * @param s The session into which the test cases will be loaded.
 * @return list of test suites.
 */
@SuppressWarnings("String_Node_Str") private static synchronized List<IRefTestSuitePO> getRefTestSuitesFor(String tsGuid,List<Long> parentProjectIds,EntityManager s){
  StringBuffer queryBuffer=new StringBuffer("String_Node_Str");
  for (  long id : parentProjectIds) {
    queryBuffer.append("String_Node_Str" + id + "String_Node_Str");
  }
  queryBuffer.delete(queryBuffer.length() - 4,queryBuffer.length());
  queryBuffer.append("String_Node_Str");
  Query q=s.createQuery(queryBuffer.toString());
  q.setParameter("String_Node_Str",tsGuid);
  List<IRefTestSuitePO> refTestSuiteList=q.getResultList();
  return refTestSuiteList;
}

Fixed version (ground truth):
/** 
 * @param tsGuid The GUID of the reused test suite.
 * @param parentProjectIds All returned test suites will have one of these astheir project parent ID.
 * @param s The session into which the test cases will be loaded.
 * @return list of test suites.
 */
@SuppressWarnings("String_Node_Str") private static synchronized List<IRefTestSuitePO> getRefTestSuitesFor(String tsGuid,List<Long> parentProjectIds,EntityManager s){
  StringBuffer queryBuffer=new StringBuffer("String_Node_Str");
  Query q=s.createQuery(queryBuffer.toString());
  q.setParameter("String_Node_Str",tsGuid);
  q.setParameter("String_Node_Str",parentProjectIds);
  List<IRefTestSuitePO> refTestSuiteList=q.getResultList();
  return refTestSuiteList;
}
Program: 95783
Project: 95783
Buggy source:
/** 
 * Returns the node under the given point
 * @param pos the point
 * @return the component
 */
public static Node getComponentByPos(Point2D pos){
  List<? extends Node> comps=getAssignableFrom(Node.class);
  List<Node> matches=new ArrayList<Node>();
  for (  Node n : comps) {
    if (n.getScene() == null || !NodeBounds.checkIfContains(pos,n)) {
      continue;
    }
    if (isSupported(n.getClass())) {
      boolean add=true;
      Parent parent=n.getParent();
      while (parent != null) {
        if (parent instanceof Skinnable) {
          if (isContentNode(n,parent)) {
            break;
          }
          Skin skin=((Skinnable)parent).getSkin();
          if (skin instanceof SkinBase) {
            if (isSkinNode(n,(SkinBase)skin)) {
              add=false;
              break;
            }
          }
        }
 else {
          parent=parent.getParent();
        }
      }
      if (add) {
        matches.add(n);
      }
    }
  }
  if (matches.size() == 0) {
    return null;
  }
  if (matches.size() == 1) {
    return matches.get(0);
  }
  return filterMatches(matches);
}

Fixed version (ground truth):
/** 
 * Returns the node under the given point
 * @param pos the point
 * @return the component
 */
public static Node getComponentByPos(Point2D pos){
  List<? extends Window> comps=getAssignableFrom(Window.class);
  List<Node> matches=new ArrayList<Node>();
  for (  Window window : comps) {
    if (window.isFocused() && window.isShowing()) {
      Parent root=window.getScene().getRoot();
      matches=getAllNodesforPos(root,pos,matches);
    }
  }
  List<Node> result=new ArrayList<Node>();
  for (  Node n : matches) {
    if (n.getScene() == null || !isSupported(n.getClass()) || !n.isVisible()) {
      continue;
    }
    boolean add=true;
    Parent parent=n.getParent();
    while (parent != null) {
      if (parent instanceof Skinnable) {
        if (isContentNode(n,parent)) {
          break;
        }
        Skin skin=((Skinnable)parent).getSkin();
        if (skin instanceof SkinBase) {
          if (isSkinNode(n,(SkinBase)skin)) {
            add=false;
            break;
          }
        }
 else {
          parent=parent.getParent();
        }
      }
 else {
        parent=parent.getParent();
      }
    }
    if (add) {
      result.add(n);
    }
  }
  if (result.size() == 0) {
    return null;
  }
  if (result.size() == 1) {
    return result.get(0);
  }
  return filterMatches(result);
}