Skip to content

Commit 6f9e2bb

Browse files
committed
IO-323 What should happen in FileUtils.sizeOf[Directory] when an overflow takes place?
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1468637 13f79535-47bb-0310-9956-ffa450edef68
1 parent 38aff30 commit 6f9e2bb

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/changes/changes.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ The <action> type attribute can be add,update,fix,remove.
4747
<body>
4848
<!-- The release date is the date RC is cut -->
4949
<release version="2.5" date="2013-??-??" description="New features and bug fixes.">
50+
<action issue="IO-323" dev="sebb" type="fix">
51+
What should happen in FileUtils.sizeOf[Directory] when an overflow takes place?
52+
Added Javadoc.
53+
</action>
5054
<action issue="IO-372" dev="sebb" type="fix">
5155
FileUtils.moveDirectory can produce misleading error message on failiure
5256
</action>

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2448,7 +2448,11 @@ public static void forceMkdirParent(final File file) throws IOException {
24482448
* If the argument is a directory, then the size of the directory is
24492449
* calculated recursively. If a directory or subdirectory is security
24502450
* restricted, its size will not be included.
2451-
*
2451+
* <p>
2452+
* Note that overflow is not detected, and the return value may be negative if
2453+
* overflow occurs. See {@link #sizeOfAsBigInteger(File)} for an alternative
2454+
* method that does not overflow.
2455+
*
24522456
* @param file the regular file or directory to return the size
24532457
* of (must not be {@code null}).
24542458
*
@@ -2510,6 +2514,11 @@ public static BigInteger sizeOfAsBigInteger(final File file) {
25102514

25112515
/**
25122516
* Counts the size of a directory recursively (sum of the length of all files).
2517+
* <p>
2518+
* Note that overflow is not detected, and the return value may be negative if
2519+
* overflow occurs. See {@link #sizeOfDirectoryAsBigInteger(File)} for an alternative
2520+
* method that does not overflow.
2521+
*
25132522
*
25142523
* @param directory
25152524
* directory to inspect, must not be {@code null}

0 commit comments

Comments
 (0)