Cleanups
Follow-up to Idc6f419a Change-Id: I4aae8f4e19f27a0a309879dc19af6e40906d58c5main
parent
8018051022
commit
1c5b2a41ec
|
@ -164,10 +164,10 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
try {
|
try {
|
||||||
parseKeyboard(parser);
|
parseKeyboard(parser);
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
Log.w(BUILDER_TAG, "keyboard XML parse error: " + e);
|
Log.w(BUILDER_TAG, "keyboard XML parse error", e);
|
||||||
throw new IllegalArgumentException(e);
|
throw new IllegalArgumentException(e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(BUILDER_TAG, "keyboard XML parse error: " + e);
|
Log.w(BUILDER_TAG, "keyboard XML parse error", e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
parser.close();
|
parser.close();
|
||||||
|
|
|
@ -210,7 +210,7 @@ final class BinaryDictionaryGetter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
Log.e(TAG, "IOException trying to cleanup files : " + e);
|
Log.e(TAG, "IOException trying to cleanup files", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,9 +321,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
tempFile.renameTo(file);
|
tempFile.renameTo(file);
|
||||||
clearFusionDictionary();
|
clearFusionDictionary();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IO exception while writing file: " + e);
|
Log.e(TAG, "IO exception while writing file", e);
|
||||||
} catch (UnsupportedFormatException e) {
|
} catch (UnsupportedFormatException e) {
|
||||||
Log.e(TAG, "Unsupported format: " + e);
|
Log.e(TAG, "Unsupported format", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -122,9 +122,9 @@ public final class UserHistoryDictIOUtils {
|
||||||
BinaryDictInputOutput.writeDictionaryBinary(destination, fusionDict, formatOptions);
|
BinaryDictInputOutput.writeDictionaryBinary(destination, fusionDict, formatOptions);
|
||||||
Log.d(TAG, "end writing");
|
Log.d(TAG, "end writing");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IO exception while writing file: " + e);
|
Log.e(TAG, "IO exception while writing file", e);
|
||||||
} catch (UnsupportedFormatException e) {
|
} catch (UnsupportedFormatException e) {
|
||||||
Log.e(TAG, "Unsupported fomat: " + e);
|
Log.e(TAG, "Unsupported format", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +184,11 @@ public final class UserHistoryDictIOUtils {
|
||||||
BinaryDictIOUtils.readUnigramsAndBigramsBinary(buffer, unigrams, frequencies,
|
BinaryDictIOUtils.readUnigramsAndBigramsBinary(buffer, unigrams, frequencies,
|
||||||
bigrams);
|
bigrams);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IO exception while reading file: " + e);
|
Log.e(TAG, "IO exception while reading file", e);
|
||||||
} catch (UnsupportedFormatException e) {
|
} catch (UnsupportedFormatException e) {
|
||||||
Log.e(TAG, "Unsupported format: " + e);
|
Log.e(TAG, "Unsupported format", e);
|
||||||
} catch (ArrayIndexOutOfBoundsException e) {
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
Log.e(TAG, "ArrayIndexOutOfBoundsException while reading file: " + e);
|
Log.e(TAG, "ArrayIndexOutOfBoundsException while reading file", e);
|
||||||
}
|
}
|
||||||
addWordsFromWordMap(unigrams, frequencies, bigrams, dict);
|
addWordsFromWordMap(unigrams, frequencies, bigrams, dict);
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,7 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
throw e;
|
throw e;
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Exception while spellcheking: " + e);
|
Log.e(TAG, "Exception while spellcheking", e);
|
||||||
return AndroidSpellCheckerService.getNotInDictEmptySuggestions();
|
return AndroidSpellCheckerService.getNotInDictEmptySuggestions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase
|
||||||
out.flush();
|
out.flush();
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IO exception while writing file: " + e);
|
Log.e(TAG, "IO exception while writing file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,9 +155,9 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase
|
||||||
UserHistoryDictIOUtils.readDictionaryBinary(
|
UserHistoryDictIOUtils.readDictionaryBinary(
|
||||||
new UserHistoryDictIOUtils.ByteArrayWrapper(buffer), listener);
|
new UserHistoryDictIOUtils.ByteArrayWrapper(buffer), listener);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(TAG, "file not found: " + e);
|
Log.e(TAG, "file not found", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException: " + e);
|
Log.e(TAG, "IOException", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (inStream != null) {
|
if (inStream != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -191,7 +191,7 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase
|
||||||
try {
|
try {
|
||||||
file = File.createTempFile("testReadAndWrite", ".dict", getContext().getCacheDir());
|
file = File.createTempFile("testReadAndWrite", ".dict", getContext().getCacheDir());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.d(TAG, "IOException while creating a temporary file: " + e);
|
Log.d(TAG, "IOException while creating a temporary file", e);
|
||||||
}
|
}
|
||||||
assertNotNull(file);
|
assertNotNull(file);
|
||||||
|
|
||||||
|
|
|
@ -116,13 +116,13 @@ public class BinaryDictIOTests extends AndroidTestCase {
|
||||||
return new BinaryDictInputOutput.ByteBufferWrapper(buffer);
|
return new BinaryDictInputOutput.ByteBufferWrapper(buffer);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException while making buffer: " + e);
|
Log.e(TAG, "IOException while making buffer", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (inStream != null) {
|
if (inStream != null) {
|
||||||
try {
|
try {
|
||||||
inStream.close();
|
inStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException while closing stream: " + e);
|
Log.e(TAG, "IOException while closing stream", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,9 +195,9 @@ public class BinaryDictIOTests extends AndroidTestCase {
|
||||||
out.flush();
|
out.flush();
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IO exception while writing file: " + e);
|
Log.e(TAG, "IO exception while writing file", e);
|
||||||
} catch (UnsupportedFormatException e) {
|
} catch (UnsupportedFormatException e) {
|
||||||
Log.e(TAG, "UnsupportedFormatException: " + e);
|
Log.e(TAG, "UnsupportedFormatException", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return diff;
|
return diff;
|
||||||
|
@ -257,9 +257,9 @@ public class BinaryDictIOTests extends AndroidTestCase {
|
||||||
dict = BinaryDictInputOutput.readDictionaryBinary(buffer, null);
|
dict = BinaryDictInputOutput.readDictionaryBinary(buffer, null);
|
||||||
diff = System.currentTimeMillis() - now;
|
diff = System.currentTimeMillis() - now;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException while reading dictionary: " + e);
|
Log.e(TAG, "IOException while reading dictionary", e);
|
||||||
} catch (UnsupportedFormatException e) {
|
} catch (UnsupportedFormatException e) {
|
||||||
Log.e(TAG, "Unsupported format: " + e);
|
Log.e(TAG, "Unsupported format", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkDictionary(dict, words, bigrams, shortcutMap);
|
checkDictionary(dict, words, bigrams, shortcutMap);
|
||||||
|
@ -275,7 +275,7 @@ public class BinaryDictIOTests extends AndroidTestCase {
|
||||||
try {
|
try {
|
||||||
file = File.createTempFile("runReadAndWrite", ".dict", getContext().getCacheDir());
|
file = File.createTempFile("runReadAndWrite", ".dict", getContext().getCacheDir());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException: " + e);
|
Log.e(TAG, "IOException", e);
|
||||||
}
|
}
|
||||||
assertNotNull(file);
|
assertNotNull(file);
|
||||||
|
|
||||||
|
@ -392,9 +392,9 @@ public class BinaryDictIOTests extends AndroidTestCase {
|
||||||
resultBigrams);
|
resultBigrams);
|
||||||
diff = System.currentTimeMillis() - now;
|
diff = System.currentTimeMillis() - now;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException " + e);
|
Log.e(TAG, "IOException", e);
|
||||||
} catch (UnsupportedFormatException e) {
|
} catch (UnsupportedFormatException e) {
|
||||||
Log.e(TAG, "UnsupportedFormatException: " + e);
|
Log.e(TAG, "UnsupportedFormatException", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (inStream != null) {
|
if (inStream != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -416,7 +416,7 @@ public class BinaryDictIOTests extends AndroidTestCase {
|
||||||
try {
|
try {
|
||||||
file = File.createTempFile("runReadUnigrams", ".dict", getContext().getCacheDir());
|
file = File.createTempFile("runReadUnigrams", ".dict", getContext().getCacheDir());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException: " + e);
|
Log.e(TAG, "IOException", e);
|
||||||
}
|
}
|
||||||
assertNotNull(file);
|
assertNotNull(file);
|
||||||
|
|
||||||
|
@ -499,9 +499,9 @@ public class BinaryDictIOTests extends AndroidTestCase {
|
||||||
position = BinaryDictIOUtils.getTerminalPosition(buffer, word);
|
position = BinaryDictIOUtils.getTerminalPosition(buffer, word);
|
||||||
diff = System.nanoTime() - now;
|
diff = System.nanoTime() - now;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException while getTerminalPosition: " + e);
|
Log.e(TAG, "IOException while getTerminalPosition", e);
|
||||||
} catch (UnsupportedFormatException e) {
|
} catch (UnsupportedFormatException e) {
|
||||||
Log.e(TAG, "UnsupportedFormatException while getTermianlPosition: " + e);
|
Log.e(TAG, "UnsupportedFormatException while getTerminalPosition", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(FormatSpec.NOT_VALID_WORD != position, contained);
|
assertEquals(FormatSpec.NOT_VALID_WORD != position, contained);
|
||||||
|
|
Loading…
Reference in New Issue