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

File.exists() fails with unicode characters in name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • None
    • sparc
    • solaris_7

      I have a very simply java class that reads the contents of a directory via the File.listFiles() method then iterates
      through that list of files and makes sure that each file in the list exists via the File.exists() method. Simple, eh?
      (source attached)

      Well to add a bit of a twist to this, one of the files contained in the directory has a unicode character in it's name.

      When I run this class with jdk1.3.1, the class reports that files in the directory exists, as expected.

      When I run this class with jdk1.4, the class reports that the file with unicode characters Does NOT exist, even though
      it is present in the File System and appears that Files.listFiles() was able to find it. (see below for output).

      What gives???

      I have attached a zip which contains the contents of the directory below.

      Any insight you have is much appreciated

      Eric


      sqeel:/home/elambert/testUni/testFile 204 % ls -l
      total 10
      drwxrwxr-x 3 elambert green 512 Aug 9 00:26 ./
      drwxrwxr-x 3 elambert green 512 Aug 9 00:22 ../
      drwxrwxr-x 2 elambert green 512 Aug 8 23:07 pkgs00701?/
      -rw-rw-r-- 1 elambert green 996 Aug 9 00:26 testIt.class
      -rw-rw-r-- 1 elambert green 596 Aug 9 00:26 testIt.java
      sqeel:/home/elambert/testUni/testFile 205 % /net/koori.sfbay/a/v01/jdk/1.3.1/fcs/binaries/solsparc/bin/java -cp . testIt
      ./pkgs00701? exists
      ^^^^^^^^^^^^^^^^^^
      ./testIt.class exists
      ./testIt.java exists
      sqeel:/home/elambert/testUni/testFile 206 % /net/Koori.sfbay/a/v07/jdk/1.4/fcs/binaries/solsparc/bin/java -cp . testIt
      ./pkgs00701? DOES NOT EXIST
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      ./testIt.class exists
      ./testIt.java exists
      sqeel:/home/elambert/testUni/testFile 207 %

            iris Iris Clark
            mmcclosksunw Michael Mccloskey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: