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

(fs) FileStore should support file stores with > Long.MAX_VALUE capacity

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 14
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Code that is written to detect a negative return value from the modified methods may be affected. The returned values potentially being smaller than the actual quantities should not be a problem.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Make java.nio.file.FileStore.getTotalSpace and analogous methods return Long.MAX_VALUE instead of a negative value when the size of the space exceeds the range of a long.

      Problem

      Currently if the size of the type of space they correspond to exceeds the maximum value of a long, the methods getTotalSpace, getUnallocatedSpace, and getUsableSpace return a negative value. This is not helpful as it is ambiguous as to whether an overflow occurred or there was some other error.

      Solution

      Make the aforementioned methods return Long.MAX_VALUE if the size of the spaces they correspond to overflows a long.

      Specification

      The essence of the specification change is to add a sentence similar to this

          * If the number of unallocated bytes is greater than
          * {@link Long#MAX_VALUE}, then {@code Long.MAX_VALUE} will be returned.

      to the specifications of the getTotalSpace, getUnallocatedSpace, and getUsableSpace methods of java.nio.file.FileStore. The complete changes are in the attached webrev archive.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bpb Brian Burkhalter
              Reporter:
              webbuggrp Webbug Group
              Reviewed By:
              Alan Bateman, Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: