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

FileOutputStream throws OOME on long file names on Windows

XMLWordPrintable

    • b23
    • 6
    • b78
    • x86
    • windows_xp

      OPERATING SYSTEM(S):
      Windows XP

      FULL JDK VERSION(S):
      java version "1.6.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b67)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b67, mixed mode)


      DESCRIPTION:
      If you run the following test on Java 6, the program gives and outofmemory exception. It should throw a FileNotFound exception

      import java.io.FileOutputStream;
      import java.io.IOException;

      class FileOutputStreamTest {
          public static void main (String[] args) {
              try {
                  String tobes = new String();
                  for (int i =0; i < 65000; i++) {
                      tobes=tobes + "a";
                  }
                  FileOutputStream out = new FileOutputStream(tobes);
                  out.close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      }


      This problem has started to occur since SunBug 6182812 has been applied.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: