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

FileOutputStream close() can't release the file control.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.2
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      1.4.2_10, 5.0_06 and 6.0_71

      ADDITIONAL OS VERSION INFORMATION :
      windows XP with SP2(simple chinese)

      A DESCRIPTION OF THE PROBLEM :
      On closing a FileOutputStream to a file, the file associated with the FileOutputStream is not released and it cannot be deleted.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the code.
      2. Try to delete the file

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      file can be delete.
      ACTUAL -
      OS prompt error a diaglog, can't find the file.and suggest to user search tools to confirm is filename.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Windows - Opens a popup window saying file cannot be deleted

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      public class Test
      {

          public static void main(String[] args) throws InterruptedException, IOException
          {

              File file = new File("c:\\a.txt");
              FileOutputStream fos = new FileOutputStream(file);
              fos = new FileOutputStream(file);
              fos.close();
              while(true)
              {}
          }
      }
      ---------- 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: