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

(fs) Files.copy description of REPLACE_EXISTING is hard to read

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P5 P5
    • 19
    • core-libs
    • None
    • behavioral
    • minimal
    • Minimal risk as this change merely clarifies verbiage describing existing behavior.
    • Java API
    • SE

      Summary

      Clarify the descriptions of the use of java.nio.file.StandardCopyOption.REPLACE_EXISTING in the copy(Path,Path) and move(Path,Path) methods of java.nio.file.Files.

      Problem

      The existing description of REPLACE_EXISTING is confusing to some.

      Solution

      Clarify the description of REPLACE_EXISTING in Files.

      Specification

      --- a/src/java.base/share/classes/java/nio/file/Files.java
      +++ b/src/java.base/share/classes/java/nio/file/Files.java
      @@ -1219,10 +1219,9 @@ public final class Files {
            * <tbody>
            * <tr>
            *   <th scope="row"> {@link StandardCopyOption#REPLACE_EXISTING REPLACE_EXISTING} </th>
      -     *   <td> If the target file exists, then the target file is replaced if it
      -     *     is not a non-empty directory. If the target file exists and is a
      -     *     symbolic link, then the symbolic link itself, not the target of
      -     *     the link, is replaced. </td>
      +     *   <td> Replace an existing file. A non-empty directory cannot be
      +     *     replaced. If the target file exists and is a symbolic link, then the
      +     *     symbolic link itself, not the target of the link, is replaced. </td>
            * </tr>
            * <tr>
            *   <th scope="row"> {@link StandardCopyOption#COPY_ATTRIBUTES COPY_ATTRIBUTES} </th>
      @@ -1342,10 +1341,9 @@ public final class Files {
            * <tbody>
            * <tr>
            *   <th scope="row"> {@link StandardCopyOption#REPLACE_EXISTING REPLACE_EXISTING} </th>
      -     *   <td> If the target file exists, then the target file is replaced if it
      -     *     is not a non-empty directory. If the target file exists and is a
      -     *     symbolic link, then the symbolic link itself, not the target of
      -     *     the link, is replaced. </td>
      +     *   <td> Replace an existing file. A non-empty directory cannot be
      +     *     replaced. If the target file exists and is a symbolic link, then the
      +     *     symbolic link itself, not the target of the link, is replaced. </td>
            * </tr>
            * <tr>
            *   <th scope="row"> {@link StandardCopyOption#ATOMIC_MOVE ATOMIC_MOVE} </th>

            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: