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

FileChooser : .url files not filtered

XMLWordPrintable

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

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [version 10.0.10586]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Windows 10 Education

      A DESCRIPTION OF THE PROBLEM :
      Filters seems not to be working for .url files, that are always selectable no matter what. Selecting one results in a nullPointerException

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a fileChooser with any filter(s)
      Go to a directory with a .url file
      See it being selectable
      Select it

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      .url file not shown, so no possible nullPointerException
      ACTUAL -
      .url file shown, nullPointerException if selected

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Caused by: java.lang.NullPointerException
      at java.io.File.<init>(File.java:277)
      at com.sun.glass.ui.CommonDialogs.createFileChooserResult(CommonDialogs.java:255)
      at com.sun.glass.ui.win.WinCommonDialogs._showFileChooser(Native Method)
      at com.sun.glass.ui.win.WinCommonDialogs.showFileChooser_impl(WinCommonDialogs.java:56)
      at com.sun.glass.ui.win.WinApplication.staticCommonDialogs_showFileChooser(WinApplication.java:311)
      at com.sun.glass.ui.CommonDialogs.showFileChooser(CommonDialogs.java:212)
      at com.sun.javafx.tk.quantum.QuantumToolkit.showFileChooser(QuantumToolkit.java:1496)
      at javafx.stage.FileChooser.showDialog(FileChooser.java:416)
      at javafx.stage.FileChooser.showOpenDialog(FileChooser.java:350)
      at UI.SSCCE.<init>(SSCCE.java:26)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.stage.FileChooser;
      import javafx.stage.Stage;

      public class SSCCE extends Application {
          private Stage primaryStage;

          public void start(Stage primaryStage) {
              this.primaryStage = primaryStage;
              this.primaryStage.setTitle("SSCCE");

          }

          public SSCCE() {
              FileChooser fileChooser = new FileChooser();

              FileChooser.ExtensionFilter extensionFilter = new FileChooser.ExtensionFilter(
                      "XML Files (*.xml)", "*.xml");
              fileChooser.getExtensionFilters().add(extensionFilter);

              fileChooser.showOpenDialog(primaryStage);
          }

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

            ddhill David Hill (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: