Merge "Close FileChannels in UpdateHandler#copyFile." into nyc-dev am: fce8ed98aa
am: 14ff0a66f0
* commit '14ff0a66f0fbda0dde63b4cf7b92595568e2d55e':
Close FileChannels in UpdateHandler#copyFile.
This commit is contained in:
commit
30069c96ab
1 changed files with 10 additions and 2 deletions
|
@ -689,8 +689,16 @@ public final class UpdateHandler {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
final FileChannel sourceChannel = ((FileInputStream) in).getChannel();
|
final FileChannel sourceChannel = ((FileInputStream) in).getChannel();
|
||||||
final FileChannel destinationChannel = ((FileOutputStream) out).getChannel();
|
try {
|
||||||
sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel);
|
final FileChannel destinationChannel = ((FileOutputStream) out).getChannel();
|
||||||
|
try {
|
||||||
|
sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel);
|
||||||
|
} finally {
|
||||||
|
destinationChannel.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
sourceChannel.close();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Can't work with channels, or something went wrong. Copy by hand.
|
// Can't work with channels, or something went wrong. Copy by hand.
|
||||||
DebugLogUtils.l("Won't work");
|
DebugLogUtils.l("Won't work");
|
||||||
|
|
Loading…
Reference in a new issue