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

JFileChooser Create New Folder button enabled in write proteced directory

    XMLWordPrintable

Details

    • b110
    • solaris_10

    Description

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.7.0_25-b15)

      ADDITIONAL OS VERSION INFORMATION :
      SunOS 5.10 Generic_148888-05 sun4u sparc SUNW,Sun-Fire-V890

      A DESCRIPTION OF THE PROBLEM :
      The New Folder button near the top right of a JFileChooser does not become disabled when displaying the contents of a write-protected directory in Java 7. Pressing the New Folder button in this situation appears to have no effect.

      REGRESSION. Last worked in version 6u45

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a directory, removing all write permission to it.
      Display a JFileChooser using the Metal Look and Feel.
      Change the directory without write permission.

      See if the Create New Folder button is disabled.
      Press the Create New Folder button.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Create New Folder button is disabled.
      Attempting to press the button will not cause any change including the button being depressed.
      ACTUAL -
      Create New Folder button is enabled.
      Pressing the button caused the button to be depressed and caused the FileName text box to change its contents to contain " NewFolder "

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public static void main(String[] argv) {

      try {
         UIManager.setLookAndFeel(new MetalLookAndFeel());
      }
      catch (UnsupportedLookAndFeelException ulafe) {
        ulafe.printStackTrace();
      }

      JFrame frame = new JFrame();
      JFileChooser fc = new JFileChooser( " /auto " );

      fc.showOpenDialog(frame);
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Add a PropertyChangeListener event
      In the event of a DIRECTORY_CHANGED_PROPERTY event, call the Create New Folder button's setEnabled method passing in getCurrentDirectory().canWrite()

      Attachments

        Activity

          People

            malenkov Sergey Malenkov (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: