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

Temp file doesn't work properly with File.renameTo() on Solaris

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.0
    • core-libs
    • None
    • sparc
    • solaris_2.6

      File.renameTo() doesn't behave the same way on Win32 and Solaris.
      The following simple test shows the problem.

      import java.io.*;

      public class test {
          public static void main(String argv[]) throws IOException {
              File tmpFile = File.createTempFile("tmp");
              System.out.println(tmpFile);
              File inputFile = new File("junk");
              System.out.println(inputFile);
      // another bug here, see 4017593
      // win32 needs a delete() before rename
              inputFile.delete();
              System.out.println(tmpFile.renameTo(inputFile));
          }
      }


      On Solaris, if property java.io.tmpdir is set to another mounted
      filesystem other than the current one , or the user specifies
      that explicitly when creating the tmpFile, the renameTo() call
      will fail.

      On Win32, the test works as expected.

            mr Mark Reinhold
            zlisunw Zhenghua Li (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: