am 03105290: Merge "Throw exception when the header cannot be read."

* commit '03105290d840c86b6fe9376bade466e606391141':
  Throw exception when the header cannot be read.
main
Keisuke Kuroyanagi 2014-02-18 21:01:16 -08:00 committed by Android Git Automerger
commit 20dee7106e
1 changed files with 3 additions and 0 deletions

View File

@ -173,6 +173,9 @@ public class Ver2DictDecoder extends AbstractDictDecoder {
@Override
public DictionaryHeader readHeader() throws IOException, UnsupportedFormatException {
final DictionaryHeader header = mBinaryDictionary.getHeader();
if (header == null) {
throw new IOException("Cannot read the dictionary header.");
}
if (header.mFormatOptions.mVersion != FormatSpec.VERSION2) {
throw new UnsupportedFormatException("File header has a wrong version : "
+ header.mFormatOptions.mVersion);