diff options
author | 2016-02-25 04:26:19 +0000 | |
---|---|---|
committer | 2016-02-25 04:26:19 +0000 | |
commit | 30069c96ab21a63ccb175957454d6b18289a48f7 (patch) | |
tree | 12eec6de84c5815597733d211348aa7d78f31ef9 /java/src | |
parent | ac1aaa43cca539fff10568c4a75641b30c335493 (diff) | |
parent | 14ff0a66f0fbda0dde63b4cf7b92595568e2d55e (diff) | |
download | latinime-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.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"); |