Merge "Throw exception when the header cannot be read."

This commit is contained in:
Keisuke Kuroyanagi 2014-02-19 04:59:47 +00:00 committed by Android (Google) Code Review
commit 03105290d8

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);