OSDN Git Service

Correct some lint warnings
[android-x86/packages-apps-Eleven.git] / src / org / lineageos / eleven / provider / LocalizedStore.java
index 76c7ea3..0e3ae9d 100644 (file)
@@ -394,22 +394,15 @@ public class LocalizedStore {
             Log.d(TAG, "Running selection: " + selection);
         }
 
-        Cursor c = null;
-        try {
-            c = mMusicDatabase.getReadableDatabase().rawQuery(selection, null);
-
+        try (Cursor c = mMusicDatabase.getReadableDatabase().rawQuery(selection, null)) {
             if (c != null && c.moveToFirst()) {
                 sortData.ids = new long[c.getCount()];
-                sortData.bucketLabels = new ArrayList<String>(c.getCount());
+                sortData.bucketLabels = new ArrayList<>(c.getCount());
                 do {
                     sortData.ids[c.getPosition()] = c.getLong(0);
                     sortData.bucketLabels.add(c.getString(1));
                 } while (c.moveToNext());
             }
-        } finally {
-            if (c != null) {
-                c.close();
-            }
         }
 
         return sortData;