am 1b7ad876: Merge change I6b51a98a into eclair-mr2

Merge commit '1b7ad876f1274787d7609a31e4a2a852adb94c3c' into eclair-mr2-plus-aosp

* commit '1b7ad876f1274787d7609a31e4a2a852adb94c3c':
  Fixed issue #4098: Ringtone#getTitle does not close its cursor.
This commit is contained in:
Josh Guilfoyle
2009-10-06 16:40:07 -07:00
committed by Android Git Automerger

View File

@@ -137,11 +137,17 @@ public class Ringtone {
cursor = res.query(uri, MEDIA_COLUMNS, null, null, null); cursor = res.query(uri, MEDIA_COLUMNS, null, null, null);
} }
if (cursor != null && cursor.getCount() == 1) { try {
cursor.moveToFirst(); if (cursor != null && cursor.getCount() == 1) {
return cursor.getString(2); cursor.moveToFirst();
} else { return cursor.getString(2);
title = uri.getLastPathSegment(); } else {
title = uri.getLastPathSegment();
}
} finally {
if (cursor != null) {
cursor.close();
}
} }
} }
} }