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

NPEs in ListView with no SelectionModel

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: openjfx13
    • Fix Version/s: openjfx14
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux_ubuntu

      Description

      A DESCRIPTION OF THE PROBLEM :
      While there are many places in ListViewBehavior that check if list's selection model is not null, there are still a couple of places that assume it exists. One of them is mousePressed method, triggered by clicking on cells, and another is activate, triggered by pressing either enter, space or f2 when list view has focus.

      You can reproduce it by creating a list view, setting it's selection model to null and then clicking on it's items and pressing enter.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create an application with ListView without selection model:
      2. Run it
      3. Click on items in list view, or press Space, Enter or F2 with Listview in focus

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      no exceptions
      ACTUAL -
      null pointer exceptions

      ---------- BEGIN SOURCE ----------
      public static class TestApp extends Application {

          @Override
          public void start(Stage primaryStage) throws Exception {
              ListView<String> listView = new ListView<>(FXCollections.observableArrayList("a", "b", "c"));
              listView.setSelectionModel(null);
              primaryStage.setScene(new Scene(listView));
              primaryStage.show();

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

      CUSTOMER SUBMITTED WORKAROUND :
      I can install custom event dispatcher on a list view that will prevent clicks and Space/Enter/F2 key presses from propagation

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aghaisas Ajit Ghaisas
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: