Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8171228

StackOverflowError on MenuBarSkin when handling key-events and only menu is disabled

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      Pressing ALT-<left-arrow> or ALT-<right-arrow> on application having all menus disabled will cause StackOverflowError.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run attached example program, press ALT-<arrow-left>

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Nothing would happen (no Exception at least)
      ACTUAL -
      java.lang.StackOverflowError is thrown

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "JavaFX Application Thread" java.lang.StackOverflowError
                  at com.sun.javafx.collections.ObservableListWrapper.size(ObservableListWrapper.java:94)
                  at com.sun.javafx.collections.VetoableListDecorator.size(VetoableListDecorator.java:176)
                  at com.sun.javafx.scene.control.skin.MenuBarSkin.findPreviousSibling(MenuBarSkin.java:995)
                  at com.sun.javafx.scene.control.skin.MenuBarSkin.findPreviousSibling(MenuBarSkin.java:1000)
                  at com.sun.javafx.scene.control.skin.MenuBarSkin.findPreviousSibling(MenuBarSkin.java:1000)
                  at com.sun.javafx.scene.control.skin.MenuBarSkin.findPreviousSibling(MenuBarSkin.java:1000)
                  at com.sun.javafx.scene.control.skin.MenuBarSkin.findPreviousSibling(MenuBarSkin.java:1000)
                  at com.sun.javafx.scene.control.skin.MenuBarSkin.findPreviousSibling(MenuBarSkin.java:1000)
                  at com.sun.javafx.scene.control.skin.MenuBarSkin.findPreviousSibling(MenuBarSkin.java:1000)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class MenuBarTest extends Application {

      public MenuBarTest() {
      }

      @Override
      public void start(Stage stage) throws Exception {
      Scene scene = new Scene(new VBox(), 400, 350);

      MenuBar menuBar = new MenuBar();
      Menu hiddenMenu = new Menu("Disabled");
      menuBar.getMenus().addAll(hiddenMenu);

      ((VBox) scene.getRoot()).getChildren().addAll(menuBar);

      stage.setScene(scene);
      menuBar.requestFocus();

      stage.show();

      hiddenMenu.setDisable(true);
      }

      public static void main(String[] args) {
      launch(args);
      }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No exception is thrown if there is another menu available that is not disabled

            aghaisas Ajit Ghaisas
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: