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
@@ -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);