Merge "List column names in the error message" into oc-mr1-dev
am: 2729912a35
Change-Id: Ia477660fdee2f94f042d0c3d463481ee550abd56
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user