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

GtkFileDialog does not point to the correct file(s) is Recent Files are used.

XMLWordPrintable

    • b27
    • x86
    • linux

        FULL PRODUCT VERSION :


        ADDITIONAL OS VERSION INFORMATION :
        Linux mint 12 and openjdk

        A DESCRIPTION OF THE PROBLEM :
        OpenJDK Runtime Environment (IcedTea7 2.0) (7~b147-2.0-0ubuntu0.11.10.1)
        OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a new java.awt.FileDialog with mode set to FileDialog.LOAD. Select files from the 'recently used' folder section. Print out the absolute path of the files selected.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Correct file and path information for each file.
        ACTUAL -
        The path will be the cwd + the filename.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        N/A, I wrote a patch to fix this.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.FileDialog;
        import java.awt.Frame;
        import java.io.File;

        public class TestFileChooser{

            public static void main(String[] args){
                FileDialog choose = new FileDialog((Frame)null,"Choose File",FileDialog.LOAD);
                choose.setMultipleMode(true);
                choose.setVisible(true);
                System.out.println(choose.getDirectory());

                File[] files = choose.getFiles();
                for(File f: files){
                
                    System.out.println(f.getAbsolutePath());
                
                }
                System.exit(0);
            
            }

        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        "Recent Documents" enables opening multiple files from different directories. This is a fundamental problem in the awt.FileDialog.setFiles(String directory, String[] filenames). This method should be replaced with a setFiles(File[] selected_files) with complete path information where all files are not assumed to be in the same directory.

        As a work around sun_awt_X11_GtkFileDialogPeer.c should check to see if the 'current_folder' is still null, if it is still null it should return the directory as root directory and the filenames as complete path names, this would be consistent

              anthony Anthony Petrov (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: