diff options
Diffstat (limited to 'src/com/android/settings/search/Index.java')
-rw-r--r-- | src/com/android/settings/search/Index.java | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java index c58923f..055c2d8 100644 --- a/src/com/android/settings/search/Index.java +++ b/src/com/android/settings/search/Index.java @@ -31,6 +31,7 @@ import android.database.DatabaseUtils; import android.database.MergeCursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; +import android.database.sqlite.SQLiteFullException; import android.net.Uri; import android.os.AsyncTask; import android.provider.SearchIndexableData; @@ -1189,14 +1190,15 @@ public class Index { final boolean forceUpdate = params[0].forceUpdate; - final SQLiteDatabase database = getWritableDatabase(); - if (database == null) { - Log.e(LOG_TAG, "Cannot update Index as I cannot get a writable database"); - return null; - } - final String localeStr = Locale.getDefault().toString(); + SQLiteDatabase database = null; try { + database = getWritableDatabase(); + if (database == null) { + Log.e(LOG_TAG, "Cannot update Index as I cannot get a writable database"); + return null; + } + final String localeStr = Locale.getDefault().toString(); database.beginTransaction(); if (dataToDelete.size() > 0) { processDataToDelete(database, localeStr, dataToDelete); @@ -1206,8 +1208,19 @@ public class Index { forceUpdate); } database.setTransactionSuccessful(); + } catch (SQLiteFullException e) { + Log.e(LOG_TAG, "SQLite database is full." + e.toString()); + } catch (SQLiteException e) { + Log.e(LOG_TAG, e.toString()); } finally { - database.endTransaction(); + try { + if (database != null) + database.endTransaction(); + } catch (SQLiteFullException e) { + Log.e(LOG_TAG, "SQLite database is full." + e.toString()); + } catch (SQLiteException e) { + Log.e(LOG_TAG, e.toString()); + } } return null; |