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

Reproducible Test for JDK-8179014 (JFileChooser crashes on win 10 + jre8u131)

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

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

      FULL OS VERSION :
      Win10 1703

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      GodMode Directory for Windows (see attached Source!)

      A DESCRIPTION OF THE PROBLEM :
      If a "GodMode" Directory exists in userHome the JFileChooser will crash on this directory (or even other directorys!)

      reproduceable Test.java attached!

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: No

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached Test - it will crash the jvm on win10 1703!

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Should not crash jvm
      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      import java.io.File;
      import java.io.IOException;

      import java.nio.file.Path;
      import java.nio.file.Paths;
      import java.nio.file.Files;

      import javax.swing.JFileChooser;
      import javax.swing.filechooser.FileSystemView;

      // Test works only win10 1703 and newer?
      // http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8179014
      public class Test extends JFrame {
        public static void main(String args[]) {
          try{
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          } catch(Exception e){
            e.printStackTrace();
            return;
          }

          final FileSystemView fsv = FileSystemView.getFileSystemView();

          // works fine
          System.out.println("Home:" + FileSystemView.getFileSystemView().getHomeDirectory());

          Path godDir = Paths.get(FileSystemView.getFileSystemView().getHomeDirectory().toString(), "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}");
          if (Files.exists(godDir))
          {
            System.out.println("deleting : " + godDir);
            try
            {
               Files.delete(godDir);
            }
            catch (IOException e)
            {
               throw new AssertionError("could not delete: " + e.getMessage(), e);
            }
          }

          // if a dir "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}" is present on windows crash - else OK!
          JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory(), fsv );
          System.out.println("Works fine!");

          try
          {
             Files.createDirectory(godDir);
          }
          catch (IOException e)
          {
              throw new AssertionError("should not happen: " + e.getMessage(), e);
          }

          System.out.println("call with GodDir");
          jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory(), fsv );
          throw new AssertionError("should not reach this point!");
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Delete GodMode Dir in userHome!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pardesha Pardeep Sharma
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: