summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorJangwon Lee <jangwon.lee@lge.com>2012-12-20 13:50:57 +0900
committergit-lg-database.lge.com <lg-database@lge.com>2012-12-20 13:59:52 +0900
commit2a3b91846e73cf6917b50050206e10fafd0302b1 (patch)
treeb64b5ce7a67642e25e42f17daa1c987a7684fee5 /core/jni
parent5b6069ce3a87d30960e9ef5870299db90090776b (diff)
downloadframeworks_base-2a3b91846e73cf6917b50050206e10fafd0302b1.zip
frameworks_base-2a3b91846e73cf6917b50050206e10fafd0302b1.tar.gz
frameworks_base-2a3b91846e73cf6917b50050206e10fafd0302b1.tar.bz2
Fix bugs regarding IllegalStateException during moving position in cursorwindow.
"startPos + addedRows < requiredPos" could miss a row in boundary position. Because of the fluctuating row size, "startPos + addedRows < requiredPos" expression could miss a row in boundary position. For example, simply speaking, if window capacity = 120 and requiredPos = 120, "fillWindow" needs to be newly called and "starPos" is 80 for the window. Unfortunately 120th row is bigger than the rest size of the window, the row for requiredPos is not in the window. Then, startPos has to be newly set and the 120th row has to be included in the window. But by the expression above "startPos + addedRows < requiredPos", the row for requiredPos is regarded as included in the window. In that case, by "mCurrentRowID = Long.valueOf(getLong(mRowIdColumnIndex));" statment in AbstractCursor, IllegalStateException is thrown. This patch contains modification of the expression as "startPos + addedRows <= requiredPos". Change-Id: Iaee75241e495949b0a624b836843da18d0bcb98d
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_database_SQLiteConnection.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp
index c9cf2fa..f70f0d1 100644
--- a/core/jni/android_database_SQLiteConnection.cpp
+++ b/core/jni/android_database_SQLiteConnection.cpp
@@ -706,7 +706,7 @@ static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz,
}
CopyRowResult cpr = copyRow(env, window, statement, numColumns, startPos, addedRows);
- if (cpr == CPR_FULL && addedRows && startPos + addedRows < requiredPos) {
+ if (cpr == CPR_FULL && addedRows && startPos + addedRows <= requiredPos) {
// We filled the window before we got to the one row that we really wanted.
// Clear the window and start filling it again from here.
// TODO: Would be nicer if we could progressively replace earlier rows.