1

使用 delete() 语句从 ContentProvider 中删除所有行会导致 Coverity 错误。

显式取消引用空 (FORWARD_NULL)
将空指针选择传递给删除,从而取消引用。

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

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

有什么办法可以解决这个 Coverity 问题吗?

4

1 回答 1

1

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 : "", 
于 2014-10-17T08:24:04.197 回答