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.
- csr of
-
JDK-8162520 (fs) FileStore should support file stores with > Long.MAX_VALUE capacity
-
- Resolved
-
- relates to
-
JDK-8233426 File getUsableSpace() returns a negative number on very large file system
-
- Closed
-