aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2016-02-25 04:26:19 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-02-25 04:26:19 +0000
commit30069c96ab21a63ccb175957454d6b18289a48f7 (patch)
tree12eec6de84c5815597733d211348aa7d78f31ef9 /java/src
parentac1aaa43cca539fff10568c4a75641b30c335493 (diff)
parent14ff0a66f0fbda0dde63b4cf7b92595568e2d55e (diff)
downloadlatinime-30069c96ab21a63ccb175957454d6b18289a48f7.tar.gz
latinime-30069c96ab21a63ccb175957454d6b18289a48f7.tar.xz
latinime-30069c96ab21a63ccb175957454d6b18289a48f7.zip
Merge "Close FileChannels in UpdateHandler#copyFile." into nyc-dev am: fce8ed98aa
am: 14ff0a66f0 * commit '14ff0a66f0fbda0dde63b4cf7b92595568e2d55e': Close FileChannels in UpdateHandler#copyFile.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
index 0517bc814..6b32c684f 100644
--- a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
+++ b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
@@ -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");