Program: 95423
Project: 95423
Buggy source:
/** 
 * Opens the context menu of the given node and finds it with Window.impl_getWindows(). Use this method for components which are not a subclass of Control and therefore don't have the context menu property
 * @param xPos what x position
 * @param xUnits should x position be pixel or percent values
 * @param yPos what y position
 * @param yUnits should y position be pixel or percent values
 * @param button MouseButton
 * @param n the Node
 * @return a MenuTester instance which references the context menu
 */
protected AbstractMenuTester openContextMenu(int xPos,String xUnits,int yPos,String yUnits,int button,Node n){
  boolean isAbsoluteUnitsX=ValueSets.Unit.pixel.rcValue().equalsIgnoreCase(xUnits);
  boolean isAbsoluteUnitsY=ValueSets.Unit.pixel.rcValue().equalsIgnoreCase(yUnits);
  getRobot().click(n,null,ClickOptions.create().setClickCount(1).setMouseButton(button),xPos,isAbsoluteUnitsX,yPos,isAbsoluteUnitsY);
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<MenuTester>(){
    @Override public MenuTester call() throws Exception {
      MenuTester menuTester=null;
      Iterator<Window> iter=Window.impl_getWindows();
      ArrayList<ContextMenu> result=new ArrayList<>();
      long timeout=TimeoutConstants.SERVER_TIMEOUT_WAIT_FOR_POPUP;
      long done=System.currentTimeMillis() + timeout;
      long now;
      do {
        if (!iter.hasNext()) {
          iter=Window.impl_getWindows();
        }
        Window w=iter.next();
        if (w instanceof ContextMenu && !result.contains(w)) {
          result.add((ContextMenu)w);
        }
        now=System.currentTimeMillis();
        timeout=done - now;
      }
 while (timeout > 0 && !(!iter.hasNext() && result.size() > 0));
      if (result.size() == 1) {
        ContextMenu cm=result.get(0);
        menuTester=new MenuTester();
        menuTester.setComponent(cm);
      }
 else       if (result.size() == 0) {
        throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.POPUP_NOT_FOUND));
      }
 else       if (result.size() > 1) {
        throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.UNSUPPORTED_OPERATION_IN_TOOLKIT_ERROR));
      }
      return menuTester;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Opens the context menu of the given node and finds it with Window.impl_getWindows(). Use this method for components which are not a subclass of Control and therefore don't have the context menu property
 * @param xPos what x position
 * @param xUnits should x position be pixel or percent values
 * @param yPos what y position
 * @param yUnits should y position be pixel or percent values
 * @param button MouseButton
 * @param n the Node
 * @return a MenuTester instance which references the context menu
 */
protected AbstractMenuTester openContextMenu(int xPos,String xUnits,int yPos,String yUnits,int button,Node n){
  boolean isAbsoluteUnitsX=ValueSets.Unit.pixel.rcValue().equalsIgnoreCase(xUnits);
  boolean isAbsoluteUnitsY=ValueSets.Unit.pixel.rcValue().equalsIgnoreCase(yUnits);
  getRobot().click(n,null,ClickOptions.create().setClickCount(1).setMouseButton(button),xPos,isAbsoluteUnitsX,yPos,isAbsoluteUnitsY);
  return EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<MenuTester>(){
    @Override public MenuTester call() throws Exception {
      MenuTester menuTester=null;
      Iterator<Window> iter=WindowsUtil.getWindowIterator();
      ArrayList<ContextMenu> result=new ArrayList<>();
      long timeout=TimeoutConstants.SERVER_TIMEOUT_WAIT_FOR_POPUP;
      long done=System.currentTimeMillis() + timeout;
      long now;
      do {
        if (!iter.hasNext()) {
          iter=WindowsUtil.getWindowIterator();
        }
        Window w=iter.next();
        if (w instanceof ContextMenu && !result.contains(w)) {
          result.add((ContextMenu)w);
        }
        now=System.currentTimeMillis();
        timeout=done - now;
      }
 while (timeout > 0 && !(!iter.hasNext() && result.size() > 0));
      if (result.size() == 1) {
        ContextMenu cm=result.get(0);
        menuTester=new MenuTester();
        menuTester.setComponent(cm);
      }
 else       if (result.size() == 0) {
        throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.POPUP_NOT_FOUND));
      }
 else       if (result.size() > 1) {
        throw new StepExecutionException("String_Node_Str",EventFactory.createActionError(TestErrorEvent.UNSUPPORTED_OPERATION_IN_TOOLKIT_ERROR));
      }
      return menuTester;
    }
  }
);
}