diff options
| author | Vasu Nori <vnori@google.com> | 2010-11-29 11:22:22 -0800 |
|---|---|---|
| committer | Vasu Nori <vnori@google.com> | 2010-11-29 11:53:55 -0800 |
| commit | b37f8a8af15425ed3e65104e8556099d33a9c1ce (patch) | |
| tree | 1bc90cf91427cb17603017f91e8fbe3819febcb2 | |
| parent | 00e40171892c73295b6e7221ed83126731230b98 (diff) | |
| download | frameworks_base-b37f8a8af15425ed3e65104e8556099d33a9c1ce.zip frameworks_base-b37f8a8af15425ed3e65104e8556099d33a9c1ce.tar.gz frameworks_base-b37f8a8af15425ed3e65104e8556099d33a9c1ce.tar.bz2 | |
fix messages from sqlite layer in c++ code to be useful.
Change-Id: Ib13f86f3481aae391f5e887bb14877f12bf48034
| -rw-r--r-- | core/jni/android_database_CursorWindow.cpp | 14 | ||||
| -rw-r--r-- | libs/binder/CursorWindow.cpp | 6 |
2 files changed, 13 insertions, 7 deletions
diff --git a/core/jni/android_database_CursorWindow.cpp b/core/jni/android_database_CursorWindow.cpp index 040dac3..fad9539 100644 --- a/core/jni/android_database_CursorWindow.cpp +++ b/core/jni/android_database_CursorWindow.cpp @@ -63,7 +63,8 @@ static void native_init_empty(JNIEnv * env, jobject object, jboolean localOnly) } if (!window->initBuffer(localOnly)) { - jniThrowException(env, "java/lang/IllegalStateException", "Couldn't init cursor window"); + jniThrowException(env, "java/lang/RuntimeException", + "Memory couldn't be allocated for 1MB CursorWindow object."); delete window; return; } @@ -82,11 +83,13 @@ static void native_init_memory(JNIEnv * env, jobject object, jobject memObj) CursorWindow * window = new CursorWindow(); if (!window) { - jniThrowException(env, "java/lang/RuntimeException", "No memory for native window object"); + jniThrowException(env, "java/lang/RuntimeException", + "CursorWindow of size 1MB couldn't be created. No memory?"); return; } if (!window->setMemory(memory)) { - jniThrowException(env, "java/lang/RuntimeException", "No memory in memObj"); + jniThrowException(env, "java/lang/RuntimeException", + "Memory couldn't be initialized for 1MB CursorWindow object."); delete window; return; } @@ -131,8 +134,9 @@ LOG_WINDOW("Closing window %p", window); static void throwExceptionWithRowCol(JNIEnv * env, jint row, jint column) { - char buf[100]; - snprintf(buf, sizeof(buf), "get field slot from row %d col %d failed", row, column); + char buf[200]; + snprintf(buf, sizeof(buf), "Couldn't read row %d, col %d from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it", + row, column); jniThrowException(env, "java/lang/IllegalStateException", buf); } diff --git a/libs/binder/CursorWindow.cpp b/libs/binder/CursorWindow.cpp index fbba281..47bbd04 100644 --- a/libs/binder/CursorWindow.cpp +++ b/libs/binder/CursorWindow.cpp @@ -219,7 +219,8 @@ LOG_WINDOW("follwing 'pointer' to next chunk, offset of next pointer is %d", chu field_slot_t * CursorWindow::getFieldSlotWithCheck(int row, int column) { if (row < 0 || row >= mHeader->numRows || column < 0 || column >= mHeader->numColumns) { - LOGE("Bad request for field slot %d,%d. numRows = %d, numColumns = %d", row, column, mHeader->numRows, mHeader->numColumns); + LOGE("Failed to read row# %d, column# from a CursorWindow which has %d rows, %d columns.", + row, column, mHeader->numRows, mHeader->numColumns); return NULL; } row_slot_t * rowSlot = getRowSlot(row); @@ -238,7 +239,8 @@ field_slot_t * CursorWindow::getFieldSlotWithCheck(int row, int column) uint32_t CursorWindow::read_field_slot(int row, int column, field_slot_t * slotOut) { if (row < 0 || row >= mHeader->numRows || column < 0 || column >= mHeader->numColumns) { - LOGE("Bad request for field slot %d,%d. numRows = %d, numColumns = %d", row, column, mHeader->numRows, mHeader->numColumns); + LOGE("Can't read row# %d, col# %d from CursorWindow. Make sure your Cursor is initialized correctly.", + row, column); return -1; } row_slot_t * rowSlot = getRowSlot(row); |
