greenDAO icon indicating copy to clipboard operation
greenDAO copied to clipboard

Blocker issue in Sonarqube

Open bj6785 opened this issue 3 years ago • 1 comments

In AutoCreated file DaoMaster.java file, we can see the code:

public static DaoSession newDevSession(Context context, String name) {
   Database db = new DevOpenHelper(context, name).getWritableDb();
   DaoMaster daoMaster = new DaoMaster(db);
  return daoMaster.newSession();

}

the sonarqube show: Use try-with-resources or close this "DevOpenHelper" in a "finally" clause. Resources should be closed

bj6785 avatar Mar 31 '22 08:03 bj6785

The code is correct, the database should remain open. Otherwise the returned DaoSession would have no database to work with.

I suggest to ignore this message (maybe add a note).

greenrobot-team avatar Apr 04 '22 08:04 greenrobot-team

Closing this issue due to inactivity. :zzz: Feel free to comment with more details or submit a new issue.

greenrobot-team avatar Oct 31 '22 10:10 greenrobot-team