Close FileChannels in UpdateHandler#copyFile.
Bug: 26239281 Change-Id: Ib30beb3548f8fb4a8e338b5da863ae28c252bc2bmain
parent
706fce9bb0
commit
3e2670265e
|
@ -689,8 +689,16 @@ public final class UpdateHandler {
|
|||
} else {
|
||||
try {
|
||||
final FileChannel sourceChannel = ((FileInputStream) in).getChannel();
|
||||
final FileChannel destinationChannel = ((FileOutputStream) out).getChannel();
|
||||
sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel);
|
||||
try {
|
||||
final FileChannel destinationChannel = ((FileOutputStream) out).getChannel();
|
||||
try {
|
||||
sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel);
|
||||
} finally {
|
||||
destinationChannel.close();
|
||||
}
|
||||
} finally {
|
||||
sourceChannel.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Can't work with channels, or something went wrong. Copy by hand.
|
||||
DebugLogUtils.l("Won't work");
|
||||
|
|
Loading…
Reference in New Issue