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

Commit 2729912a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "List column names in the error message" into oc-mr1-dev

parents 82f289a4 848485bb
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.os.UserHandle;
import android.util.Log;

import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

@@ -330,7 +331,14 @@ public abstract class AbstractCursor implements CrossProcessCursor {
    public int getColumnIndexOrThrow(String columnName) {
        final int index = getColumnIndex(columnName);
        if (index < 0) {
            throw new IllegalArgumentException("column '" + columnName + "' does not exist");
            String availableColumns = "";
            try {
                availableColumns = Arrays.toString(getColumnNames());
            } catch (Exception e) {
                Log.d(TAG, "Cannot collect column names for debug purposes", e);
            }
            throw new IllegalArgumentException("column '" + columnName
                    + "' does not exist. Available columns: " + availableColumns);
        }
        return index;
    }