diff options
author | 2016-02-25 04:25:24 +0000 | |
---|---|---|
committer | 2016-02-25 04:25:24 +0000 | |
commit | 14ff0a66f0fbda0dde63b4cf7b92595568e2d55e (patch) | |
tree | 7228744cc7651d75fb1cbf3f832676d9f9d03382 /java/src | |
parent | 9f1498ca138c69cefb241fe41510452924173b32 (diff) | |
parent | fce8ed98aa738a13332b6ccc9c5b145f17fae51f (diff) | |
download | latinime-14ff0a66f0fbda0dde63b4cf7b92595568e2d55e.tar.gz latinime-14ff0a66f0fbda0dde63b4cf7b92595568e2d55e.tar.xz latinime-14ff0a66f0fbda0dde63b4cf7b92595568e2d55e.zip |
Merge "Close FileChannels in UpdateHandler#copyFile." into nyc-dev
am: fce8ed98aa
* commit 'fce8ed98aa738a13332b6ccc9c5b145f17fae51f':
Close FileChannels in UpdateHandler#copyFile.
Diffstat (limited to 'java/src')
-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"); |