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

File.renameTo() fail conditions are non-clear

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.2
    • core-libs
    • x86
    • linux

      The problem is in the following phrase:
      -----------------------------------
           Whether or not this method can move a file from one filesystem to another is platform-dependent. The return value should always be checked to make sure that the rename operation was successful.
      ------------------------------------

      It seems that accordingly with such specification attempt to move file from one filesystem to another is single legal reason to avoid renaming.

      However there are at least following reasons for renaming to fail:

      * native platform does not support some kinds of renaming (for example, renaming directories in the BREW platform)
      * source File instance represents abstract pathname for which there is no existing file
      * there are no write permissions (in the filesystem meaning) for directory containing either source or destination File instance (or for source/destination files)
      * destination File instance repesents abstract pathname for which file can't be created
      due to the filesystem restrictions
      * destination File instance repesents abstract pathname assuming creation of the several intermediate subdirectories

      I think more general wording should be provided about possible fail of renaming.

            sherman Xueming Shen
            sreznick Sergey Reznick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: