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

TabPane with no tabs throws Exception when HOME key is pressed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8u60
    • javafx
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      If a TabPane has no tabs, pressing the HOME key will throw the following exception (test program included in the Steps to Reproduce section):

      Exception in thread "JavaFX Application Thread" java.lang.ArithmeticException: / by zero
      at com.sun.javafx.scene.control.behavior.TabPaneBehavior.nextIndex(TabPaneBehavior.java:187)
      at com.sun.javafx.scene.control.behavior.TabPaneBehavior.findValidTab(TabPaneBehavior.java:175)
      at com.sun.javafx.scene.control.behavior.TabPaneBehavior.moveSelection(TabPaneBehavior.java:160)
      at com.sun.javafx.scene.control.behavior.TabPaneBehavior.callAction(TabPaneBehavior.java:88)
      at com.sun.javafx.scene.control.behavior.BehaviorBase.callActionForEvent(BehaviorBase.java:218)
      at com.sun.javafx.scene.control.behavior.BehaviorBase.lambda$new$74(BehaviorBase.java:135)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:198)
      at javafx.scene.Scene$KeyHandler.process(Scene.java:3964)
      at javafx.scene.Scene$KeyHandler.access$1800(Scene.java:3910)
      at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2040)
      at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2501)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:197)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:147)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$354(GlassViewEventHandler.java:228)
      at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:227)
      at com.sun.glass.ui.View.handleKeyEvent(View.java:546)
      at com.sun.glass.ui.View.notifyKey(View.java:966)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.lambda$null$149(WinApplication.java:191)
      at java.lang.Thread.run(Thread.java:745)




      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      To reproduce, run the following program...when the empty window appears, ensure it has the focus and press the HOME key. The exception is generated always.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TabPane;
      import javafx.stage.Stage;

      /**
       * Run this then press the HOME key and ... BOOM!
       */
      public class TabPaneHomeTest extends Application {

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

        @Override
        public void start(Stage stage) {
          final TabPane tabPane = new TabPane();
          stage.setScene(new Scene(tabPane));
          stage.show();
        }
        
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expected no exception.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TabPane;
      import javafx.stage.Stage;

      /**
       * Run this then press the HOME key and ... BOOM!
       */
      public class TabPaneHomeTest extends Application {

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

        @Override
        public void start(Stage stage) {
          final TabPane tabPane = new TabPane();
          stage.setScene(new Scene(tabPane));
          stage.show();
        }
        
      }
      ---------- END SOURCE ----------

            arapte Ambarish Rapte
            webbuggrp Webbug Group
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: