Switch SelectionBuilder to accept Object[], fix NPE.

Change-Id: I8d6ef1b47d89e4fc643402075f0549f4c4277a0f
This commit is contained in:
Jeff Sharkey
2010-03-15 15:08:12 -07:00
parent cf2826ec99
commit 0cd57a44ea

View File

@@ -47,7 +47,7 @@ public class SelectionBuilder {
* Append the given selection clause to the internal state. Each clause is
* surrounded with parenthesis and combined using {@code AND}.
*/
public SelectionBuilder append(String selection, String... selectionArgs) {
public SelectionBuilder append(String selection, Object... selectionArgs) {
if (TextUtils.isEmpty(selection)) {
if (selectionArgs != null && selectionArgs.length > 0) {
throw new IllegalArgumentException(
@@ -63,8 +63,12 @@ public class SelectionBuilder {
}
mSelection.append("(").append(selection).append(")");
for (String arg : selectionArgs) {
mSelectionArgs.add(arg);
if (selectionArgs != null) {
for (Object arg : selectionArgs) {
// TODO: switch to storing direct Object instances once
// http://b/2464440 is fixed
mSelectionArgs.add(String.valueOf(arg));
}
}
return this;