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

Temporary files generated by Java applications remain when VM terminates

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 1.4.0_01
    • core-libs
    • x86
    • windows_nt

      This bug has been filed to add the missing functionality for deleteOnExit
      function in java.io.File class.

      Whenever a temporary file is created by an application using "createTempFile" function of java.io.File, deleteOnExit function registers with the VM that it should be deleted when the VM exits.

      However, this is valid only for normal termination of the VM. If a signal
      terminates the VM, like Ctrl-C, the temporary file does not get deleted and hence the temporary files start getting adding up.

      This behavior has been observed in Windows.

      The attached test file, "tempfiletest.java" can be run in any Windows NT machine
      after changing the third argument of line 10. This is to specify the directory
      on the local machine where the temporary file needs to be generated.

      After compiling and running the test program, it is observed that the temporary
      file is generated while the for loop is running. However, if the VM terminates
      normally, the temporary file gets deleted on it's own. If Ctrl-C is done while
      the for loop is on, the temporary file remains behind.

            kkladkosunw Konstantin Kladko (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: