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

JFileChooser accepts characters for file name more than 255 but discards once enter is pressed

XMLWordPrintable

      OPERATING SYSTEM(S):
      --------------------
      Windows XP

      FULL JDK VERSION(S):
      -------------------
      java version "1.6.0_04"
      Java(TM) SE Runtime Environment (build 1.6.0_04-b07)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

      DESCRIPTION:
      ------------

      File creation in JFileChooser simply discards characters more than 255 with out informing though it accpets any no of characters as compared to the FileChooser of the normal Windows XP Notepad Application.

      Reproduction instructions:

      1. Run the following java program to create folders with longer names:

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

      public class createFile {
      public static void main(String args[]) throws IOException{
      File f = new File("C:\\tmp\\1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890\\1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890.1234567890");

      System.out.println(f.mkdirs());
      }
      }


      2. Run SwingSet2.jar
      3. Go to "FileChooser" demo.
      4. Click on "Show Plain JFileChooser"
      5. Select "C" drive & then select "tmp" then select the folder with
         long name created by above program
      6. Press F2 to rename this folder.
      7. Try to append "Xabc" to end of this folder.

      Observed result:
      It accepts. But, when you press enter to rename the above folder, it simply discards "xabc" after 255 characters and retains the same folder.

      Expected result:
      It should not accept "Xabc", once it has reached maximum limit.

      Note: Please use Normal Windows Xp Notepad's File Chooser to confirm the expected behavior.

            Unassigned Unassigned
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: