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

NullPointerException when using Combobox in combination with accessibility app

    XMLWordPrintable

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      When using an accessibility app like e.g. PhraseExpress in combination with a Combobox on screen, I get a NullPointerException each time the value of the combobox changes.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Download and install PhraseExpress for mac (http://www.phraseexpress.com/) - Free to use for 10 phrases
      2. Launch PhraseExpress
      3. Open the test app
      4. Change the value of the combobox

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Value of the combobox changes
      ACTUAL -
      Value of the combobox changes + NullPointerException

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.queryAccessibleAttribute(ComboBoxListViewSkin.java:593)
      at javafx.scene.control.Control.queryAccessibleAttribute(Control.java:917)
      at javafx.scene.control.ComboBoxBase.queryAccessibleAttribute(ComboBoxBase.java:459)
      at javafx.scene.control.ComboBox.queryAccessibleAttribute(ComboBox.java:616)
      at javafx.scene.Node$19.getAttribute(Node.java:9648)
      at com.sun.glass.ui.Accessible$GetAttribute.run(Accessible.java:142)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.glass.ui.Accessible.lambda$getAttribute$4(Accessible.java:169)
      at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
      at com.sun.glass.ui.Accessible.getAttribute(Accessible.java:166)
      at com.sun.glass.ui.mac.MacAccessible.accessibilityAttributeValue(MacAccessible.java:1261)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class TestCase extends Application {

      @Override
      public void start(final Stage primaryStage) throws Exception {
      final ComboBox<String> comboBox = new ComboBox<>();
      comboBox.getItems().setAll("a", "b", "c");

      final Scene scene = new Scene(new StackPane(comboBox), 400, 200);
      primaryStage.setScene(scene);
      primaryStage.show();
      }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use a custom skin to fix the broken code:

      public static class CustomComboBoxListViewSkin<T> extends ComboBoxListViewSkin<T> {

      /***************************************************************************
      * * Constructors * *
      *************************************************************************
      * @param comboBox
      */
      public CustomComboBoxListViewSkin(final ComboBox<T> comboBox) {
      super(comboBox);
      }

      @Override
      public Object queryAccessibleAttribute(final AccessibleAttribute attribute, final Object... parameters) {
      switch (attribute) {
      case SELECTION_START:
      return getSkinnable().isEditable() ? getEditor().getSelection().getStart() : null;
      case SELECTION_END:
      return getSkinnable().isEditable() ? getEditor().getSelection().getEnd() : null;
      default:
      return super.queryAccessibleAttribute(attribute, parameters);
      }
      }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pkbalakr Prem Balakrishnan
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: