Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReOpen and BackupEnabled #1709

Open
baranowskinet opened this issue Dec 15, 2020 · 0 comments
Open

ReOpen and BackupEnabled #1709

baranowskinet opened this issue Dec 15, 2020 · 0 comments

Comments

@baranowskinet
Copy link

DBFlow Version: 4.2.4

Bug Request:
When database is reopen and using backupEnabled then after while following error happen:
E/Database: close() was never explicitly called on database '{dbpath}/temp-{dbname}.db'
database.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
at net.sqlcipher.database.SQLiteDatabase.(SQLiteDatabase.java:2402)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1148)
at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1212)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:162)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:129)
at com.raizlabs.android.dbflow.sqlcipher.SQLCipherOpenHelper$BackupHelper.getDatabase(SQLCipherOpenHelper.java:125)
at com.raizlabs.android.dbflow.structure.database.DatabaseHelperDelegate.movePrepackagedDB(DatabaseHelperDelegate.java:133)

Description:
This problem happen for calling backupHelper.getDatabase(); in DatabaseHelperDelegate. I am not sure why it is called in performRestoreFromBackup() function so I overwrite it without checking if backupHelper exists and calling getDatabase(). With that modification I can simply use (DatabaseDefinition).reopen without problems. Only when db will be corrupted then movePrepackagedDB will be used where inside system check integrity of temp database and then I see this error.

I think something needs to be done around close database to also close temp database (in reopen function).

Kind regards, Krzysztof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant