* commit '9b68fb745ca26f725ae174623cc6e1183f9d9ca6': Sigh, some apps are sending null ContentValues.
This commit is contained in:
@@ -1072,7 +1072,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
|
|||||||
* This must not be {@code null}.
|
* This must not be {@code null}.
|
||||||
* @return The URI for the newly inserted item.
|
* @return The URI for the newly inserted item.
|
||||||
*/
|
*/
|
||||||
public abstract @Nullable Uri insert(@NonNull Uri uri, @NonNull ContentValues values);
|
public abstract @Nullable Uri insert(@NonNull Uri uri, @Nullable ContentValues values);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override this to handle requests to insert a set of new rows, or the
|
* Override this to handle requests to insert a set of new rows, or the
|
||||||
@@ -1137,7 +1137,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
|
|||||||
* @param selection An optional filter to match rows to update.
|
* @param selection An optional filter to match rows to update.
|
||||||
* @return the number of rows affected.
|
* @return the number of rows affected.
|
||||||
*/
|
*/
|
||||||
public abstract int update(@NonNull Uri uri, @NonNull ContentValues values,
|
public abstract int update(@NonNull Uri uri, @Nullable ContentValues values,
|
||||||
@Nullable String selection, @Nullable String[] selectionArgs);
|
@Nullable String selection, @Nullable String[] selectionArgs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1218,10 +1218,8 @@ public abstract class ContentResolver {
|
|||||||
* the field. Passing an empty ContentValues will create an empty row.
|
* the field. Passing an empty ContentValues will create an empty row.
|
||||||
* @return the URL of the newly created row.
|
* @return the URL of the newly created row.
|
||||||
*/
|
*/
|
||||||
public final @Nullable Uri insert(@NonNull Uri url, @NonNull ContentValues values) {
|
public final @Nullable Uri insert(@NonNull Uri url, @Nullable ContentValues values) {
|
||||||
Preconditions.checkNotNull(url, "url");
|
Preconditions.checkNotNull(url, "url");
|
||||||
Preconditions.checkNotNull(values, "values");
|
|
||||||
|
|
||||||
IContentProvider provider = acquireProvider(url);
|
IContentProvider provider = acquireProvider(url);
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
throw new IllegalArgumentException("Unknown URL " + url);
|
throw new IllegalArgumentException("Unknown URL " + url);
|
||||||
@@ -1350,10 +1348,9 @@ public abstract class ContentResolver {
|
|||||||
* @return the number of rows updated.
|
* @return the number of rows updated.
|
||||||
* @throws NullPointerException if uri or values are null
|
* @throws NullPointerException if uri or values are null
|
||||||
*/
|
*/
|
||||||
public final int update(@NonNull Uri uri, @NonNull ContentValues values,
|
public final int update(@NonNull Uri uri, @Nullable ContentValues values,
|
||||||
@Nullable String where, @Nullable String[] selectionArgs) {
|
@Nullable String where, @Nullable String[] selectionArgs) {
|
||||||
Preconditions.checkNotNull(uri, "uri");
|
Preconditions.checkNotNull(uri, "uri");
|
||||||
Preconditions.checkNotNull(values, "values");
|
|
||||||
IContentProvider provider = acquireProvider(uri);
|
IContentProvider provider = acquireProvider(uri);
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
throw new IllegalArgumentException("Unknown URI " + uri);
|
throw new IllegalArgumentException("Unknown URI " + uri);
|
||||||
|
|||||||
Reference in New Issue
Block a user