diff options
author | 2016-02-25 04:23:32 +0000 | |
---|---|---|
committer | 2016-02-25 04:23:32 +0000 | |
commit | fce8ed98aa738a13332b6ccc9c5b145f17fae51f (patch) | |
tree | e62459509224f9f42bb12494473c91bda79ec08a /java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java | |
parent | 60b59042d1f5a1449de049a7f7adb3d6e40b8b06 (diff) | |
parent | 3e2670265e17e91c5a8cfff01711f973dccd2a0c (diff) | |
download | latinime-fce8ed98aa738a13332b6ccc9c5b145f17fae51f.tar.gz latinime-fce8ed98aa738a13332b6ccc9c5b145f17fae51f.tar.xz latinime-fce8ed98aa738a13332b6ccc9c5b145f17fae51f.zip |
Merge "Close FileChannels in UpdateHandler#copyFile." into nyc-dev
Diffstat (limited to 'java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java')
-rw-r--r-- | java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java | 12 |
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"); |