diff options
| author | 2011-01-06 16:52:35 -0800 | |
|---|---|---|
| committer | 2011-01-06 16:52:35 -0800 | |
| commit | c1ca07eebb2730a4cbef5f6ba2d98abb881a85d9 (patch) | |
| tree | 33c3ebd4a74c857024832f67438f33eb52c6ae7e | |
| parent | b9a12d7b87e39e3f1588eb8d8d28129ae5449039 (diff) | |
| parent | ca74897b24e24681e05ed35d13cf7a68bc924673 (diff) | |
Merge "in GB requery() didn't throw exceptions (mostly). replicate that in HC" into honeycomb
| -rw-r--r-- | core/java/android/database/sqlite/SQLiteCursor.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/core/java/android/database/sqlite/SQLiteCursor.java b/core/java/android/database/sqlite/SQLiteCursor.java index 5a6c66782028..26a14403a5e3 100644 --- a/core/java/android/database/sqlite/SQLiteCursor.java +++ b/core/java/android/database/sqlite/SQLiteCursor.java @@ -407,15 +407,29 @@ public class SQLiteCursor extends AbstractWindowedCursor { mWindow.clear(); } mPos = -1; - SQLiteDatabase db = mQuery.mDatabase.getDatabaseHandle(mQuery.mSql); + SQLiteDatabase db = null; + try { + db = mQuery.mDatabase.getDatabaseHandle(mQuery.mSql); + } catch (IllegalStateException e) { + // for backwards compatibility, just return false + return false; + } if (!db.equals(mQuery.mDatabase)) { // since we need to use a different database connection handle, // re-compile the query - db.lock(); + try { + db.lock(); + } catch (IllegalStateException e) { + // for backwards compatibility, just return false + return false; + } try { // close the old mQuery object and open a new one mQuery.close(); mQuery = new SQLiteQuery(db, mQuery); + } catch (IllegalStateException e) { + // for backwards compatibility, just return false + return false; } finally { db.unlock(); } @@ -427,6 +441,9 @@ public class SQLiteCursor extends AbstractWindowedCursor { queryThreadLock(); try { mQuery.requery(); + } catch (IllegalStateException e) { + // for backwards compatibility, just return false + return false; } finally { queryThreadUnlock(); } @@ -437,7 +454,12 @@ public class SQLiteCursor extends AbstractWindowedCursor { Log.v(TAG, "--- Requery()ed cursor " + this + ": " + mQuery); } - boolean result = super.requery(); + boolean result = false; + try { + result = super.requery(); + } catch (IllegalStateException e) { + // for backwards compatibility, just return false + } if (Config.LOGV) { long timeEnd = System.currentTimeMillis(); Log.v(TAG, "requery (" + (timeEnd - timeStart) + " ms): " + mDriver.toString()); |