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

java.io.File.renameTo has different semantics on Solaris and Win32

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 1.0.2, 1.1, 1.2.0
    • core-libs
    • generic, sparc
    • generic, solaris_2.5

      File.renameTo() has different semantics on Solaris and Win32.
      This routine is a thin veneer over the rename() call in the C library.
      On Win32, rename() is defined such that it is an error if the destination
      file exists. On Solaris, the destination file can exist and rename()
      has the affect of unlinking it.

      We wrote code to update a file, where we write to a temporary file first and
      then rename that file over the original. This is a pretty standard technique
      to avoid losing the original data in the file. We use renameTo() as the final
      step and this code fails on a Win32 platform.

            mr Mark Reinhold
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: