From c2521bf556fa3ad1157096507c855d19c1df2463 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 29 Nov 2017 09:59:11 +0000 Subject: [PATCH] Fix DB resource leak. It doesn't affect anything in a noticeable way, but still, obviously, worth fixing. --- app/src/main/java/com/etesync/syncadapter/App.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/etesync/syncadapter/App.java b/app/src/main/java/com/etesync/syncadapter/App.java index d2d3b55d..3dc388ce 100644 --- a/app/src/main/java/com/etesync/syncadapter/App.java +++ b/app/src/main/java/com/etesync/syncadapter/App.java @@ -134,8 +134,8 @@ public class App extends Application { } private void loadLanguage() { - String lang = new Settings(new ServiceDB.OpenHelper(this). - getReadableDatabase()).getString(App.FORCE_LANGUAGE, null); + @Cleanup ServiceDB.OpenHelper serviceDB = new ServiceDB.OpenHelper(this); + String lang = new Settings(serviceDB.getReadableDatabase()).getString(App.FORCE_LANGUAGE, null); if (lang != null && !lang.equals(DEFAULT_LANGUAGE)) { LanguageUtils.setLanguage(this, lang); }