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

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

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 14
    • core-libs
    • None
    • behavioral
    • minimal
    • 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.
    • Java API
    • SE

      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.

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

              Created:
              Updated:
              Resolved: