Skip to content

Commit

Permalink
Fix AbstractDiskHttpData int conversion from long
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fredericBregier authored and normanmaurer committed Dec 8, 2014
1 parent 69e25d2 commit cb6646d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ public boolean renameTo(File dest) throws IOException {
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);
}
Expand Down

0 comments on commit cb6646d

Please sign in to comment.