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

NPE in JFileChooser with non-ascii characters in windows user home folder name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 7u40, 8u20
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.7.0_40"
      Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
      Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows Version 6.3.9600 (Windows 8.1)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      The user name and the user home folder contain non-ascii characters, such as ü

      A DESCRIPTION OF THE PROBLEM :
      NullPointerException at sun.awt.shell.Win32ShellFolder2$1.call

      fileChooser.showOpenDialog(...) throws a NPE as shown above if the windows account and especially the windows user home folder contains non-ascii characters, such as ä,ö,ü. Looks like the non-ascii characters are not correctly interpreted, since they are translated to ? instead of ü and then the user home folder cannot be found and null is returned!

      When changing the user to a user-account without non-ascii characters, no NPE is thrown!

      As far as I know it was not working with prior Java releases, since I had the problem already in Java 6 and upgrading to Java 7 did not fix it.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      System.out.println(System.getProperty("user.home"));

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      C:\Users\Günter
      ACTUAL -
      C:\Users\G?nter

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      NullPointerException at sun.awt.shell.Win32ShellFolder2$1.call

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      System.out.println(System.getProperty("user.home"));

      JFileChooser fileChooser = new JFileChooser();
      fileChooser.showOpenDialog(null);
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The windows user home folder is not allowed to contain non-ascii characters in the folder name.

            tr Tejesh R
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: