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

(fs spec) FileStore getUsableSpace and getUnallocatedSpace could be clearer

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 23
    • core-libs
    • None
    • behavioral
    • minimal
    • Improvement of specification only; no change in behavior.
    • Java API
    • SE

      Summary

      Modify the specifications of the java.nio.file.FileStore methods getUsableSpace and getUnallocatedSpace to clarify that the returned values are current as of when the method is invoked.

      Problem

      It is not clear enough from the existing specifications of the methods in question that the values might not have been determined up front when the FileStore was created.

      Solution

      Make it clear that the returned space values are valid as of the time of the method call.

      Specification

      --- a/src/java.base/share/classes/java/nio/file/FileStore.java
      +++ b/src/java.base/share/classes/java/nio/file/FileStore.java
      @@ -103,11 +103,11 @@ protected FileStore() {
            * <p> The returned number of available bytes is a hint, but not a
            * guarantee, that it is possible to use most or any of these bytes.  The
            * number of usable bytes is most likely to be accurate immediately
      -     * after the space attributes are obtained. It is likely to be made inaccurate
      +     * after this method returns. It is likely to be made inaccurate
            * by any external I/O operations including those made on the system outside
            * of this Java virtual machine.
            *
      -     * @return  the number of bytes available
      +     * @return  the current number of usable bytes
            *
            * @throws  IOException
            *          if an I/O error occurs
      @@ -122,11 +122,11 @@ protected FileStore() {
            * <p> The returned number of unallocated bytes is a hint, but not a
            * guarantee, that it is possible to use most or any of these bytes.  The
            * number of unallocated bytes is most likely to be accurate immediately
      -     * after the space attributes are obtained. It is likely to be
      +     * after this method returns. It is likely to be
            * made inaccurate by any external I/O operations including those made on
            * the system outside of this virtual machine.
            *
      -     * @return  the number of unallocated bytes
      +     * @return  the current number of unallocated bytes
            *
            * @throws  IOException
            *          if an I/O error occurs

            bpb Brian Burkhalter
            alanb Alan Bateman
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: