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

REGRESSION: File.deleteOnExit() does not delete the file

XMLWordPrintable

    • x86
    • windows_2000

      Name: rmT116609 Date: 02/01/2002

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

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

      DESCRIPTION OF THE PROBLEM :
      java.io.File.deleteOnExit() seems to have no effect whatsoever, at least on Win2K. Files marked this way are *not* deleted, even if the JVM exist cleanly.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the test program; the file "DeleteMe" should be gone if deleteOnExit() worked as advertised. It isn't.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The file "DeleteMe" should be gone; it isn't.

      ---------- BEGIN SOURCE ----------
      import java.io.*;

      //
      // File.deleteOnExit() seems to have no effect whatsoever, at least
      // on Win2K. After running this program you would expect the file
      // called "DeleteMe" to be gone; it isn't.
      //
      public class TestDeleteOnExit
      {
          public static void main(String[] args)
          {
              try
              {
                  File f = new File("DeleteMe");

                  f.createNewFile();
                  f.deleteOnExit();
              }
              catch (IOException ex)
              {
                  ex.printStackTrace();
              }
          }
      }

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

      The problem is not reproducible on Windows 2000 using JDK1.3.1_02, 1.4.0-beta3.

      The problem is not reproducible on Solaris 2.8, Linux Redhat7.1 using 1.4.0-rc.

      CUSTOMER WORKAROUND :
      Delete the file yourself, explictly.

      Release Regression From : merlin-beta3
      The above release value was the last known release where this
      bug was knwon to work. Since then there has been a regression.

      (Review ID: 139120)
      ======================================================================

            kkladkosunw Konstantin Kladko (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: