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

[MenuBar] IOOBE when try to clear menuBar

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 7u6
    • Fix Version/s: 7u6
    • Component/s: javafx
    • Environment:

      2.2.0b10.

      Description

      Run code:

      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 JavaApplication39 extends Application {

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

          @Override
          public void start(Stage stage) throws Exception {
              MenuBar mb = new MenuBar();
              for (int i = 0; i< 5; i++) {
                  Menu menu = new Menu(String.valueOf(i));
                  mb.getMenus().add(menu);
              }
              
              VBox vb = new VBox();
              vb.getChildren().add(mb);
              
              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
              
              mb.getMenus().clear();
          }
      }

      Exception:
      Exception in Application start method
      Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
      at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403)
      at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
      at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
      at java.lang.Thread.run(Thread.java:722)
      Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.ArrayList.rangeCheck(ArrayList.java:604)
      at java.util.ArrayList.get(ArrayList.java:382)
      at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:208)
      at com.sun.javafx.scene.control.skin.MenuBarSkin.rebuildUI(MenuBarSkin.java:400)
      at com.sun.javafx.scene.control.skin.MenuBarSkin.access$1100(MenuBarSkin.java:76)
      at com.sun.javafx.scene.control.skin.MenuBarSkin$6.onChanged(MenuBarSkin.java:238)
      at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:134)
      at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
      at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:97)
      at com.sun.javafx.collections.ObservableListWrapper.clear(ObservableListWrapper.java:184)
      at javaapplication39.JavaApplication39.start(JavaApplication39.java:31) <---------------- Point in application - call clear().
      at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
      at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:175)
      at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:142)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
      at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
      ... 1 more
      Java Result: 1

        Attachments

          Activity

            People

            Assignee:
            psomashe Parvathi Somashekar (Inactive)
            Reporter:
            akirov Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: