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: Change it to long. Result: There is no more int oversized. Same fix for 4.1 and Master
This commit is contained in:
parent
69e25d21f6
commit
cb6646da13
@ -341,11 +341,11 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
|
|||||||
FileOutputStream outputStream = new FileOutputStream(dest);
|
FileOutputStream outputStream = new FileOutputStream(dest);
|
||||||
FileChannel in = inputStream.getChannel();
|
FileChannel in = inputStream.getChannel();
|
||||||
FileChannel out = outputStream.getChannel();
|
FileChannel out = outputStream.getChannel();
|
||||||
int chunkSize = 8196;
|
long chunkSize = 8196;
|
||||||
long position = 0;
|
long position = 0;
|
||||||
while (position < size) {
|
while (position < size) {
|
||||||
if (chunkSize < size - position) {
|
if (chunkSize < size - position) {
|
||||||
chunkSize = (int) (size - position);
|
chunkSize = size - position;
|
||||||
}
|
}
|
||||||
position += in.transferTo(position, chunkSize , out);
|
position += in.transferTo(position, chunkSize , out);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user