From eb44da1e6d5428c6fbe66fb88018776a0b43d614 Mon Sep 17 00:00:00 2001 From: Federico Iosue Date: Wed, 17 Apr 2019 12:32:51 +0200 Subject: [PATCH] Fixed attribute hiding and removed database connection close According to this post by a Google engineer (http://groups.google.com/group/android-developers/msg/74ee967b2fcff770), there's nothing wrong with leaving the database connection open --- .../src/main/java/it/feio/android/omninotes/db/DbHelper.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/omniNotes/src/main/java/it/feio/android/omninotes/db/DbHelper.java b/omniNotes/src/main/java/it/feio/android/omninotes/db/DbHelper.java index 099174962b..9c9876cf37 100644 --- a/omniNotes/src/main/java/it/feio/android/omninotes/db/DbHelper.java +++ b/omniNotes/src/main/java/it/feio/android/omninotes/db/DbHelper.java @@ -199,7 +199,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { public Note updateNote(Note note, boolean updateLastModification) { - SQLiteDatabase db = getDatabase(true); + db = getDatabase(true); String content = note.isLocked() ? Security.encrypt(note.getContent(), prefs.getString(Constants.PREF_PASSWORD, "")) @@ -246,7 +246,6 @@ public Note updateNote(Note note, boolean updateLastModification) { db.setTransactionSuccessful(); db.endTransaction(); - db.close(); // Fill the note with correct data before returning it note.setCreation(note.getCreation() > 0 ? note.getCreation() : values.getAsLong(KEY_CREATION));