X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2Fengine%2FDictionary.java;h=03984315afa7ef2921390fbbfcd14c3a91b22b30;hp=5b209b037da3095ebc398683331746062b237f92;hb=1ef7686713e8930fcb03e45c28805390cb8e6b5a;hpb=30a1ad573637d1781c3c47b33882b5fcddaabdf7 diff --git a/src/com/hughes/android/dictionary/engine/Dictionary.java b/src/com/hughes/android/dictionary/engine/Dictionary.java index 5b209b0..0398431 100644 --- a/src/com/hughes/android/dictionary/engine/Dictionary.java +++ b/src/com/hughes/android/dictionary/engine/Dictionary.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.io.RandomAccessFile; +import java.nio.BufferUnderflowException; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.util.ArrayList; @@ -212,6 +213,10 @@ public class Dictionary { // Most likely due to a Buffer.limit beyond size of file, // do not crash just because of a truncated dictionary file return getErrorDictionaryInfo(file); + } catch (BufferUnderflowException e) { + // Most likely due to a read beyond the buffer limit set, + // do not crash just because of a truncated or corrupt dictionary file + return getErrorDictionaryInfo(file); } finally { if (raf != null) { try {