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

[Edited] DatabaseObjectNotClosedException from executeUpdateDelete #1497

Closed
muhammadzadeh opened this issue Dec 20, 2017 · 7 comments
Closed
Labels
Milestone

Comments

@muhammadzadeh
Copy link

Hi
i am using dbflow with sqlcipher
`

def dbflow_version = "4.1.2"
def sqlcipher_version = "3.5.4"

annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}"
implementation "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}"
implementation "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}"
implementation "com.github.Raizlabs.DBFlow:dbflow-sqlcipher:${dbflow_version}"
implementation "net.zetetic:android-database-sqlcipher:${sqlcipher_version}@aar"

and my application class when as following app crash,i found helperListener is always null
public class iApplication extends Application {

@Override
public void onCreate() {
    super.onCreate();

    try {
        FlowManager.init(new FlowConfig.Builder(this)
            .addDatabaseConfig(
                    new DatabaseConfig.Builder(dDataBase.class)
                            .openHelper(new DatabaseConfig.OpenHelperCreator() {
                                @Override
                                public OpenHelper createHelper(DatabaseDefinition databaseDefinition, DatabaseHelperListener helperListener) {
                                    return new SQLCipherHelperImpl(databaseDefinition, helperListener,iApplication.this);
                                }
                            })
                            .build())
            .build());
    }
    catch (Exception e)
    {
        Log.d(dbFlowTag,e.getMessage());
    }

}

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

}
when i use this,work

public class iApplication extends Application {

@Override
public void onCreate() {
    super.onCreate();

   FlowManager.init(this);
}

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

}
`

@agrosner
Copy link
Owner

can you specify stacktrace please.

@muhammadzadeh
Copy link
Author

muhammadzadeh commented Dec 20, 2017

Sorry
i cant get stacktrace because app closing without crash in following class,in line super(databaseDefinition, listener);

`
public class SQLCipherHelperImpl extends SQLCipherOpenHelper {

private Context context;

public SQLCipherHelperImpl(DatabaseDefinition databaseDefinition
        , DatabaseHelperListener listener
        ,Context context) {
    super(databaseDefinition, listener);
    this.context=context;
}

@Override
protected String getCipherSecret() {
    return Constants.APP_USER;
}

}
`

@muhammadzadeh
Copy link
Author

@agrosner

@agrosner
Copy link
Owner

what is the crash, the helperListener will be null because you didnt specify one in the DatabaseConfig.

@muhammadzadeh
Copy link
Author

muhammadzadeh commented Dec 24, 2017

in version 4.2.3 my app not crash
stacktarce

Releasing statement in a finalizer. Please ensure that you explicitly call close() on your cursor: DELETE FROM `DutyTable` 
                                                                     net.sqlcipher.database.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
                                                                         at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:62)
                                                                         at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:109)
                                                                         at net.sqlcipher.database.SQLiteStatement.<init>(SQLiteStatement.java:39)
                                                                         at net.sqlcipher.database.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1589)
                                                                         at com.raizlabs.android.dbflow.sqlcipher.SQLCipherDatabase.compileStatement(SQLCipherDatabase.java:56)
                                                                         at com.raizlabs.android.dbflow.sql.language.BaseModelQueriable.executeUpdateDelete(BaseModelQueriable.java:111)
                                                                         at com.raizlabs.android.dbflow.sql.language.BaseModelQueriable.executeUpdateDelete(BaseModelQueriable.java:106)
                                                                         at com.raizlabs.android.dbflow.sql.language.Delete.table(Delete.java:21)
                                                                         at me.kubak.passenger.views.activity.ActSplash.continueSetup(ActSplash.java:419)
                                                                         at me.kubak.passenger.views.activity.ActSplash.onSuccessfulStart(ActSplash.java:270)
                                                                         at me.kubak.passenger.api.DataConnector$6.onResponse(DataConnector.java:584)
                                                                         at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)
                                                                         at android.os.Handler.handleCallback(Handler.java:743)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                         at android.os.Looper.loop(Looper.java:150)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5621)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)

@agrosner agrosner added the bug label Dec 28, 2017
@agrosner
Copy link
Owner

the bug appears to be something else entirely. It would have been more helpful to specify that stacktrace with proper title. I will modify title of this ticket since its something completely different.

@agrosner agrosner changed the title DatabaseHelperListener is always null [Edited] DatabaseObjectNotClosedException from executeUpdateDelete Dec 28, 2017
@agrosner agrosner added this to the 4.2.4 milestone Dec 28, 2017
@agrosner
Copy link
Owner

fixed in develop. you can try it by replacing version 4.1.2 with 3f3d0b437e

@agrosner agrosner mentioned this issue Dec 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants