j256 / ormlite-android

ORMLite Android functionality used in conjunction with ormlite-core
http://ormlite.com/
ISC License
1.59k stars 367 forks source link

W/SQLiteCursor: Close cursor android.database.sqlite.SQLiteCursor@xxxxx on null twice or more #92

Closed michaelfomin closed 6 years ago

michaelfomin commented 6 years ago

Getting a lot of warning level stack traces printed in my log.

W/SQLiteCursor: Close cursor android.database.sqlite.SQLiteCursor@e5e1f96 on null twice or more
                                                                              java.lang.Exception
                                                                                  at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:250)
                                                                                  at com.j256.ormlite.android.AndroidCompiledStatement.close(AndroidCompiledStatement.java:91)
                                                                                  at com.j256.ormlite.stmt.StatementExecutor.queryForFirst(StatementExecutor.java:108)
                                                                                  at com.j256.ormlite.dao.BaseDaoImpl.queryForFirst(BaseDaoImpl.java:233)
                                                                                  at com.j256.ormlite.stmt.QueryBuilder.queryForFirst(QueryBuilder.java:375)

Looks like this post has a fix. https://stackoverflow.com/questions/25245249/ormlite-sqlitecursor-close-cursor-on-null-twice-or-more/26066557#26066557

Is there any plan to fix this in the official release?

michaelfomin commented 6 years ago

Verified this is still an issue on ormlite-android-5.1.jar ormlite-core-5.1.jar

UPDATE: this comment is wrong. My reproduction was actually on 4.48

j256 commented 6 years ago

Huh. The code has been fixed a long time ago in 5.0. See: https://github.com/j256/ormlite-android/commit/33ba0657df9c6822dbb09272d10fbe16f4260be4#diff-3e1615fd2bc46fadd68e3b8b5b465101

I'm suspicious of the line number in AndroidCompiledStatement. You can see that the close code is on 101 now: https://github.com/j256/ormlite-android/blob/master/src/main/java/com/j256/ormlite/android/AndroidCompiledStatement.java#L99

What version of ormlite are you using?

michaelfomin commented 6 years ago

Apologies, when I 'updated' to the latest 5.1, I did not do it correctly so I was still running the old 4.48 when I tried reproduced the error. I cannot see this error on 5.1. OK to close out.

j256 commented 6 years ago

Phew.