1

Deleting all the rows from ContentProvider using delete() statement gives the Coverity error.

Explicit null dereferenced (FORWARD_NULL)
Passing null pointer selection to delete, which dereferences it.

String selection = null;
String[] selectionArgs = null;

mContentResolver.delete(MyContentProvider.MY_CONTENT_URI, selection, selectionArgs);

Is there any way to fix this Coverity issue ??

Vijay C
  • 4,739
  • 4
  • 41
  • 46

1 Answers1

2

According to your code the issue seems right - you forward "null"... Can you post the code of your ContentResolver Implementation?

To remove the warning you may try to use:

String selection = "";
String[] selectionArgs = new String[0];

As you may see in the source code the selection (at least) for logging is set to:

selection != null ? selection : "", 
Lonzak
  • 9,334
  • 5
  • 57
  • 88