Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5659df6 authored by Andy McFadden's avatar Andy McFadden Committed by Android (Google) Code Review
Browse files

Merge "Make sure cursors close"

parents ec04d651 99ae7660
Loading
Loading
Loading
Loading
+19 −16
Original line number Original line Diff line number Diff line
@@ -305,17 +305,17 @@ public class Alarms {
        // Now add the scheduled alarms
        // Now add the scheduled alarms
        final Cursor cursor = getFilteredAlarmsCursor(context.getContentResolver());
        final Cursor cursor = getFilteredAlarmsCursor(context.getContentResolver());
        if (cursor != null) {
        if (cursor != null) {
            if (cursor.moveToFirst()) {
            try {
            try {
                if (cursor.moveToFirst()) {
                    do {
                    do {
                        final Alarm a = new Alarm(cursor);
                        final Alarm a = new Alarm(cursor);
                        alarms.add(a);
                        alarms.add(a);
                    } while (cursor.moveToNext());
                    } while (cursor.moveToNext());
                }
            } finally {
            } finally {
                cursor.close();
                cursor.close();
            }
            }
        }
        }
        }


        Alarm alarm = null;
        Alarm alarm = null;


@@ -352,6 +352,7 @@ public class Alarms {
        Cursor cur = getFilteredAlarmsCursor(context.getContentResolver());
        Cursor cur = getFilteredAlarmsCursor(context.getContentResolver());
        long now = System.currentTimeMillis();
        long now = System.currentTimeMillis();


        try {
            if (cur.moveToFirst()) {
            if (cur.moveToFirst()) {
                do {
                do {
                    Alarm alarm = new Alarm(cur);
                    Alarm alarm = new Alarm(cur);
@@ -364,8 +365,10 @@ public class Alarms {
                    }
                    }
                } while (cur.moveToNext());
                } while (cur.moveToNext());
            }
            }
        } finally {
            cur.close();
            cur.close();
        }
        }
    }


    /**
    /**
     * Called at system startup, on time/timezone change, and whenever
     * Called at system startup, on time/timezone change, and whenever