Fix AbstractDiskHttpData int conversion from long

Motivations:
The chunkSize might be oversized after comparison (size being > of int capacity) if file size is bigger than an integer.

Modifications:
Changing the type to long fix the issue.

Result:
There is no more int oversized.
This commit is contained in:
Frederic Bregier 2014-12-07 13:01:51 +01:00 committed by Norman Maurer
parent 03a775a71d
commit ff9a6e0499

View File

@ -309,11 +309,11 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
FileOutputStream outputStream = new FileOutputStream(dest);
FileChannel in = inputStream.getChannel();
FileChannel out = outputStream.getChannel();
int chunkSize = 8196;
long chunkSize = 8196;
long position = 0;
while (position < size) {
if (chunkSize < size - position) {
chunkSize = (int) (size - position);
chunkSize = size - position;
}
position += in.transferTo(position, chunkSize , out);
}