aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-11-29 10:31:36 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-11-29 10:31:37 +0000
commitd7337a72bc27e77fd23fa47d5b9592dc8550ef74 (patch)
treef0900617555e02fb722d6945fd356e3935375c59 /java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
parent3f8c1d4a19bc8b27e81c3ab898d9417db4a50c8a (diff)
parent26c9af33a77f5a1af38b12cfd09639530327e9e1 (diff)
downloadlatinime-d7337a72bc27e77fd23fa47d5b9592dc8550ef74.tar.gz
latinime-d7337a72bc27e77fd23fa47d5b9592dc8550ef74.tar.xz
latinime-d7337a72bc27e77fd23fa47d5b9592dc8550ef74.zip
Merge "Fix auto-detection of format 4."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
index f0fed3fda..8833c35aa 100644
--- a/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
+++ b/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
@@ -103,7 +103,7 @@ public class Ver4DictDecoder extends AbstractDictDecoder {
mDictBuffer = mFrequencyBuffer = null;
}
- protected File getFile(final int fileType) {
+ protected File getFile(final int fileType) throws UnsupportedFormatException {
if (fileType == FILETYPE_TRIE) {
return new File(mDictDirectory,
mDictDirectory.getName() + FormatSpec.TRIE_FILE_EXTENSION);
@@ -122,12 +122,16 @@ public class Ver4DictDecoder extends AbstractDictDecoder {
mDictDirectory.getName() + FormatSpec.SHORTCUT_FILE_EXTENSION
+ FormatSpec.SHORTCUT_CONTENT_ID);
} else {
- throw new RuntimeException("Unsupported kind of file : " + fileType);
+ throw new UnsupportedFormatException("Unsupported kind of file : " + fileType);
}
}
@Override
- public void openDictBuffer() throws FileNotFoundException, IOException {
+ public void openDictBuffer() throws FileNotFoundException, IOException,
+ UnsupportedFormatException {
+ if (!mDictDirectory.isDirectory()) {
+ throw new UnsupportedFormatException("Format 4 dictionary needs a directory");
+ }
mDictBuffer = mBufferFactory.getDictionaryBuffer(getFile(FILETYPE_TRIE));
mFrequencyBuffer = mBufferFactory.getDictionaryBuffer(getFile(FILETYPE_FREQUENCY));
mTerminalAddressTableBuffer = mBufferFactory.getDictionaryBuffer(