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

FileOutputStream ctor throws IOE rather than FNF; Also possible HANDLE leak (1.4.2)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2_09
    • core-libs
    • None
    • x86
    • windows_2003

      The code
      public static void copy(java.io.File src, java.io.File target) throws IOException{
          java.io.FileInputStream fin = new java.io.FileInputStream( src );
          try {
              java.io.FileOutputStream fout = new java.io.FileOutputStream( target );
              try {
                  fin.getChannel().transferTo( 0, src.length(), fout.getChannel());
      } finally {
                  fout.close();
              }
          } finally {
              fin.close();
          }
      }

      sporadically fails if the file "target" resides on a remote filesystem which is available through a SMB share.
      The failure is twofold:
      1. On the target SMB share files of size 0 are created (either correct size or 0 size!)
      2. The target machine (Windows XP) runs out of FileDescriptors depending on the configured max value because files are not properly closed from a Windows viewpoint.

            coffeys Sean Coffey
            amuellersunw Andreas Mueller (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: