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

Commit 0167c317 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Switch SelectionBuilder to accept Object[], fix NPE."

parents 88f183eb 0cd57a44
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -47,7 +47,7 @@ public class SelectionBuilder {
     * Append the given selection clause to the internal state. Each clause is
     * Append the given selection clause to the internal state. Each clause is
     * surrounded with parenthesis and combined using {@code AND}.
     * 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 (TextUtils.isEmpty(selection)) {
            if (selectionArgs != null && selectionArgs.length > 0) {
            if (selectionArgs != null && selectionArgs.length > 0) {
                throw new IllegalArgumentException(
                throw new IllegalArgumentException(
@@ -63,8 +63,12 @@ public class SelectionBuilder {
        }
        }


        mSelection.append("(").append(selection).append(")");
        mSelection.append("(").append(selection).append(")");
        for (String arg : selectionArgs) {
        if (selectionArgs != null) {
            mSelectionArgs.add(arg);
            for (Object arg : selectionArgs) {
                // TODO: switch to storing direct Object instances once
                // http://b/2464440 is fixed
                mSelectionArgs.add(String.valueOf(arg));
            }
        }
        }


        return this;
        return this;