aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-08-16 21:35:52 +0900
committerJean Chalard <jchalard@google.com>2011-08-18 15:11:19 +0900
commit80e0bf04292867ddc769aca75ebaee817b95a941 (patch)
tree37b9bf7ef0951415a2210a4a758c836e1ce0a552 /java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
parent961453c3b3a8eb3aefb2cebdbcc315c98c2abbd4 (diff)
downloadlatinime-80e0bf04292867ddc769aca75ebaee817b95a941.tar.gz
latinime-80e0bf04292867ddc769aca75ebaee817b95a941.tar.xz
latinime-80e0bf04292867ddc769aca75ebaee817b95a941.zip
Exception refactoring
Now that the dictionary pack can return several files, it's better to handle IO exceptions for each file rather than globally. This also will help with next implementation steps. Bug: 5095140 Change-Id: I5ed135ad2ad4f55f61f9b3f92c48a35d5c24bdb2
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
index 360cf21ca..9b89b9acf 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
@@ -214,23 +214,16 @@ class BinaryDictionaryGetter {
*/
public static List<AssetFileAddress> getDictionaryFiles(final Locale locale,
final Context context, final int fallbackResId) {
- try {
- // cacheDictionariesFromContentProvider returns the list of files it copied to local
- // storage, but we don't really care about what was copied NOW: what we want is the
- // list of everything we ever cached, so we ignore the return value.
- BinaryDictionaryFileDumper.cacheDictionariesFromContentProvider(locale, context);
- List<AssetFileAddress> cachedDictionaryList = getCachedDictionaryList(locale, context);
- if (null != cachedDictionaryList) {
- return cachedDictionaryList;
- }
- // If the list is null, fall through and return the fallback
- } catch (FileNotFoundException e) {
- Log.e(TAG, "Unable to create dictionary file from provider for locale "
- + locale.toString() + ": falling back to internal dictionary");
- } catch (IOException e) {
- Log.e(TAG, "Unable to read source data for locale "
- + locale.toString() + ": falling back to internal dictionary");
+
+ // cacheDictionariesFromContentProvider returns the list of files it copied to local
+ // storage, but we don't really care about what was copied NOW: what we want is the
+ // list of everything we ever cached, so we ignore the return value.
+ BinaryDictionaryFileDumper.cacheDictionariesFromContentProvider(locale, context);
+ List<AssetFileAddress> cachedDictionaryList = getCachedDictionaryList(locale, context);
+ if (null != cachedDictionaryList) {
+ return cachedDictionaryList;
}
+
final AssetFileAddress fallbackAsset = loadFallbackResource(context, fallbackResId,
locale);
if (null == fallbackAsset) return null;