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

FileOutputStream constructors throw FileNotFoundException for unicode filenames

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.2.1, 1.4.1
    • core-libs
    • x86, sparc
    • windows_nt, windows_2000

      Name: nt126004 Date: 02/19/2003


      FULL PRODUCT VERSION :
      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]
      Service Pack 3

      A DESCRIPTION OF THE PROBLEM :
      Attempt to create a new file using any FileOutputStream
      constructor with a Chinese, Japanese or Korean filename.

      Throws a FileNotFoundException, even though the underlying
      OS natively supports Unicode filenames.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Call a constructor of FileOutputStream specifying a CJK
      filename.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      File should be created with the supplied filename, rather
      than throwing an exception.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.io.FileNotFoundException: ????? (The filename, directory name, or volume
      label syntax is incorrect)

      at java.io.FileOutputStream.open(Native Method)

      at java.io.FileOutputStream.<init>(FileOutputStream.java:102)

      at java.io.FileOutputStream.<init>(FileOutputStream.java:62)

      at com.netdimen.util.file.TestCase.main(TestCase.java:10)

      Exception in thread "main"

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.FileOutputStream;
      import java.io.IOException;

      public final class TestCase {
          public static void main(String[] args) throws IOException {
              String filename = "\u4eca\u65e5\u306f\u4e16\u754c";
              System.out.println(filename);
              FileOutputStream fos = new FileOutputStream(filename);
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Don't use CJK filenames.
      (Review ID: 181383)
      ======================================================================

            iris Iris Clark
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: