Finalizing a Cursor that has not been deactivated or closed


#1

Hi guys!

I’m using sqlcipher with content provider in Android. But when I do a query like mOpenHelper.getWritableDatabase(PASSWORD).query(). I receive the exception:

12-14 18:33:56.875 5025-5041/br.com.sysmobil.triiboclient.development E/Cursor: Finalizing a Cursor that has not been deactivated or closed. database = /data/data/br.com.sysmobil.triiboclient.development/databases/triibowifi.db, table = network, query = SELECT _id, status, type, latitude, longitude, password, registrationDate, ssid, user FROM network W
                                                                                net.sqlcipher.database.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
                                                                                    at net.sqlcipher.database.SQLiteCursor.<init>(SQLiteCursor.java:217)
                                                                                    at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
                                                                                    at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1787)
                                                                                    at net.sqlcipher.database.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1649)
                                                                                    at net.sqlcipher.database.SQLiteDatabase.query(SQLiteDatabase.java:1601)
                                                                                    at net.sqlcipher.database.SQLiteDatabase.query(SQLiteDatabase.java:1690)
                                                                                    at br.com.sysmobil.triiboclient.data.TriiboProvider.query(TriiboProvider.java:60)
                                                                                    at android.content.ContentProvider.query(ContentProvider.java:984)
                                                                                    at android.content.ContentProvider$Transport.query(ContentProvider.java:213)
                                                                                    at android.content.ContentResolver.query(ContentResolver.java:485)
                                                                                    at android.content.ContentResolver.query(ContentResolver.java:429)
                                                                                    at br.com.sysmobil.triiboclient.utils.wifi.GeoWifi.limparWifiSalvos(GeoWifi.java:181)
                                                                                    at br.com.sysmobil.triiboclient.utils.wifi.GeoWifi.onLocation(GeoWifi.java:98)
                                                                                    at br.com.sysmobil.triiboclient.services.WifiServices.onLocationChanged(WifiServices.java:150)
                                                                                    at com.google.android.gms.location.internal.zzk$zzb.handleMessage(Unknown Source)
                                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                    at android.os.Looper.loop(Looper.java:135)
                                                                                    at android.app.ActivityThread.main(ActivityThread.java:5349)
                                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                                    at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

#2

Hi @Adalberto_Fernandes

Are you able to recreate the issue within the SQLCipher for Android test suite?


#3

Hi @developernotes.

Thank you! I had to close some cursors in my application.


#4

Hello @Adalberto_Fernandes

Thank you for getting back to us, we are glad to hear you were able to resolve the issue. Take care!