From 8a06b26cb47278039f8306b93aa32830fab54468 Mon Sep 17 00:00:00 2001 From: Yuichiro Hanada Date: Tue, 10 Sep 2013 17:38:05 +0900 Subject: [PATCH] Check the version of format options before writing. Change-Id: I3951e4395a2da225e240e856c23339b679e6155e --- .../android/inputmethod/latin/makedict/Ver3DictEncoder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver3DictEncoder.java b/java/src/com/android/inputmethod/latin/makedict/Ver3DictEncoder.java index 9385ba3a0..3f26ff378 100644 --- a/java/src/com/android/inputmethod/latin/makedict/Ver3DictEncoder.java +++ b/java/src/com/android/inputmethod/latin/makedict/Ver3DictEncoder.java @@ -68,6 +68,12 @@ public class Ver3DictEncoder implements DictEncoder { @Override public void writeDictionary(final FusionDictionary dict, final FormatOptions formatOptions) throws IOException, UnsupportedFormatException { + if (formatOptions.mVersion > 3) { + throw new UnsupportedFormatException( + "The given format options has wrong version number : " + + formatOptions.mVersion); + } + if (mOutStream == null) { openStream(); }