IllegalStateException

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

IllegalStateException

Postby victoheart » Mon Jan 25, 2010 6:14 pm

Hi all,

I develope an application about Contacts Provider. It includes many database operations.

But there is a problem about sqlite exception. I have the following information exits in the log file.

I am confused. Is it normal behavior?

Thanks.

01-14 21:02:48.692 I/dalvikvm( 1923): Uncaught exception thrown by finalizer (will be discarded):
01-14 21:02:48.692 I/dalvikvm( 1923): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@2e56fef8 on people that has not been deactivated or closed
01-14 21:02:48.692 I/dalvikvm( 1923): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
01-14 21:02:48.702 I/dalvikvm( 1923): at dalvik.system.NativeStart.run(Native Method)
victoheart
Freshman
Freshman
 
Posts: 4
Joined: Wed Jan 20, 2010 9:02 am

Top

Postby jwei512 » Wed Jan 27, 2010 12:16 am

It means that you opened a cursor and didn't close it. So check your code and for any place that you have:

Cursor c = db.query( ... );

make sure that at the end of the method you call c.close()
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Postby victoheart » Thu Jan 28, 2010 11:33 am

Hi all,
I have a question. Does the cursor error cause SQLiteException?
I also have the following information in the log file.
I am confused.Do the two exception ( IllegalStateException and
SQLiteException) will occur together if I don't close one of cursors?
Thank you.

01-14 21:02:53.292 E/AndroidRuntime( 1923): Caused by: android.database.sqlite.SQLiteException: Unable to close due to unfinalised statements
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.sqlite.SQLiteDatabase.dbclose(Native Method)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.sqlite.SQLiteDatabase.onAllReferencesReleased(SQLiteDatabase.java:241)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java:42)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.sqlite.SQLiteProgram.onAllReferencesReleased(SQLiteProgram.java:67)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java:42)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.sqlite.SQLiteProgram.close(SQLiteProgram.java:221)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:141)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:507)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.database.CursorWrapper.close(CursorWrapper.java:45)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:800)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at com.android.contacts.ContactsListActivity$ContactItemListAdapter.changeCursor(ContactsListActivity.java:2393)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at com.android.contacts.ContactsListActivity.onStop(ContactsListActivity.java:1053)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1245)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.app.Activity.performStop(Activity.java:3680)
01-14 21:02:53.292 E/AndroidRuntime( 1923): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3319)
victoheart
Freshman
Freshman
 
Posts: 4
Joined: Wed Jan 20, 2010 9:02 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 5 guests