[jsword-svn] r2235 - trunk/jsword/src/main/java/org/crosswire/common/progress
mjdenham at crosswire.org
mjdenham at crosswire.org
Wed Mar 7 12:23:21 MST 2012
Author: mjdenham
Date: 2012-03-07 12:23:21 -0700 (Wed, 07 Mar 2012)
New Revision: 2235
Modified:
trunk/jsword/src/main/java/org/crosswire/common/progress/Job.java
Log:
JS-210 : use long in percent calculation to avoid integer overflow when downloading large files
Modified: trunk/jsword/src/main/java/org/crosswire/common/progress/Job.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/common/progress/Job.java 2012-03-07 19:14:34 UTC (rev 2234)
+++ trunk/jsword/src/main/java/org/crosswire/common/progress/Job.java 2012-03-07 19:23:21 UTC (rev 2235)
@@ -208,7 +208,8 @@
workUnits += step;
int oldPercent = percent;
- percent = 100 * workUnits / totalUnits;
+ // use long in arithmetic to avoid integer overflow
+ percent = (int)(100L * workUnits / totalUnits);
if (oldPercent == percent) {
return;
}
More information about the jsword-svn
mailing list