aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-12-02 18:15:22 +0900
committerJean Chalard <jchalard@google.com>2013-12-02 18:15:22 +0900
commit9ab71eda83c756d9d551fc757d07b6b81f6dfb1e (patch)
tree4e41703a9a869400978b9f266cae1221dc154c15 /java/src
parent6e587b7f178448e24518d169f2aa8bb1a74643b7 (diff)
downloadlatinime-9ab71eda83c756d9d551fc757d07b6b81f6dfb1e.tar.gz
latinime-9ab71eda83c756d9d551fc757d07b6b81f6dfb1e.tar.xz
latinime-9ab71eda83c756d9d551fc757d07b6b81f6dfb1e.zip
Fix tests.
This fixes a few bugs that became apparent with the reinstating of a test. Bug: 11954718 Change-Id: I1127bc3180f856566429f40d14c944e6f0007e09
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/FormatSpec.java9
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java6
2 files changed, 13 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
index f85431ee8..555c71b4c 100644
--- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java
@@ -379,6 +379,15 @@ public final class FormatSpec {
mHeaderSize = headerSize;
mDictionaryOptions = dictionaryOptions;
mFormatOptions = formatOptions;
+ if (null == getLocaleString()) {
+ throw new RuntimeException("Cannot create a FileHeader without a locale");
+ }
+ if (null == getVersion()) {
+ throw new RuntimeException("Cannot create a FileHeader without a version");
+ }
+ if (null == getId()) {
+ throw new RuntimeException("Cannot create a FileHeader without an ID");
+ }
}
// Helper method to get the locale as a String
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java b/java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java
index 883709f83..91d9cf345 100644
--- a/java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java
+++ b/java/src/com/android/inputmethod/latin/makedict/Ver4DictUpdater.java
@@ -140,8 +140,10 @@ public class Ver4DictUpdater extends Ver4DictDecoder implements DictUpdater {
@Override
public void deleteWord(final String word) throws IOException, UnsupportedFormatException {
- if (mDictBuffer == null) openDictBuffer();
- readHeader();
+ if (mDictBuffer == null) {
+ openDictBuffer();
+ readHeader();
+ }
final int wordPos = getTerminalPosition(word);
if (wordPos != FormatSpec.NOT_VALID_WORD) {
mDictBuffer.position(wordPos);