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

java.io.File.isDirectory() fails to identify ext3 folder with foreign characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 6
    • core-libs
    • x86
    • linux

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Linux pers 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686 GNU/Linux

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Dual boots Windows XP home (Swedish) and Ubuntu 6.10. Using windows ext2 driver (http://www.fs-driver.org) to access my Linux partition.

      A DESCRIPTION OF THE PROBLEM :
      Java fails to identify some of my directories as directories. All the files that should be identified as directories fulfils the following criterias:
      -Folder named in Windows.
      -Stored to a Linux partition of ext3 format (through Windows ext2 driver).
      -Folder name contains special Swedish characters.

      The Linux list command correctly identifies the folder.
      Both the Windows dir command and Java under Windows correctly identifies the directory as a directory.
      Under Linux the Swedish characters are not shown correctly due to different name encoding.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a java.io.File object referring to the specified folder. Issue the isDirectory() metod on the new object.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should identify the file as a folder.


      Here is the output of the Linux ls command:
      `ls -al /mnt/base/Privat/Skola/Gymnasiet`

      total 76
      drwxr-xr-x 18 per per 4096 2006-07-08 20:36 .
      drwxr-xr-x 6 per per 4096 2007-03-20 20:19 ..
      drwxr-xr-x 4 per per 4096 2006-07-08 20:17 Aktiekunskap
      drwxr-xr-x 4 per per 4096 2006-07-08 20:17 Biologi
      drwxr-xr-x 12 per per 4096 2006-07-08 20:17 Datorkunksap
      -rw-r--r-- 1 per per 78 2006-05-19 17:52 Desktop.ini
      drwxr-xr-x 3 per per 4096 2006-07-08 20:17 Engelska
      drwxr-xr-x 2 per per 4096 2006-07-08 20:17 F?retagsekonomi
      drwxr-xr-x 4 per per 4096 2006-12-17 10:41 Fysik
      drwxr-xr-x 5 per per 4096 2006-07-08 20:17 Historia
      drwxr-xr-x 2 per per 4096 2006-07-08 20:17 Idrott
      drwxr-xr-x 4 per per 4096 2006-07-08 20:17 Kemi
      drwxr-xr-x 2 per per 4096 2006-07-08 20:17 Mattematik
      drwxr-xr-x 3 per per 4096 2006-07-08 20:17 Naturvetenskap
      drwxr-xr-x 2 per per 4096 2006-12-17 10:45 Programmering
      drwxr-xr-x 2 per per 4096 2006-07-08 20:17 Religionskunskap
      drwxr-xr-x 2 per per 4096 2006-12-17 10:44 Samh?llskunskap
      drwxr-xr-x 4 per per 4096 2006-07-08 20:17 Svenska
      drwxr-xr-x 2 per per 4096 2006-07-08 20:17 Tyska

      ACTUAL -
      Here is the output in Java under Linux:

      `java Main /mnt/base/Privat/Skola/Gymnasiet`
      /mnt/base/Privat/Skola/Gymnasiet/Desktop.ini ; false ; May 19, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Tyska ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Svenska ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Samh�llskunskap ; false ; Jan 1, 1970
      /mnt/base/Privat/Skola/Gymnasiet/Religionskunskap ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Programmering ; true ; Dec 17, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Naturvetenskap ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Mattematik ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Kemi ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Idrott ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Historia ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/F�retagsekonomi ; false ; Jan 1, 1970
      /mnt/base/Privat/Skola/Gymnasiet/Fysik ; true ; Dec 17, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Engelska ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Datorkunksap ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Biologi ; true ; Jul 8, 2006
      /mnt/base/Privat/Skola/Gymnasiet/Aktiekunskap ; true ; Jul 8, 2006

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Main
      {
          public static void main(String[] args)
          {
              File file = new File(args[0]);
              File[] children = file.listFiles();
              DateFormat format = DateFormat.getDateInstance();
              for(File child : children)
              {
                  System.out.println(child.getAbsolutePath() + " ;\t " +
                              child.isDirectory() + " ;\t " +
                              format.format(new Date(child.lastModified()))
                  );
              }
          }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: