1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Use try-with-resources to close the db

This commit is contained in:
cpfeiffer 2019-01-13 20:37:37 +01:00
parent e9982ccd56
commit 3763a4ef6b

View File

@ -88,8 +88,7 @@ public class AlarmUtils {
Set<String> stringAlarms = prefs.getStringSet(MiBandConst.PREF_MIBAND_ALARMS, new HashSet<String>());
List<Alarm> alarms = new ArrayList<>(stringAlarms.size());
try {
DBHandler db = GBApplication.acquireDB();
try (DBHandler db = GBApplication.acquireDB()) {
DaoSession daoSession = db.getDaoSession();
User user = DBHelper.getUser(daoSession);
Device device = DBHelper.getDevice(gbDevice, daoSession);