Program: 24038
Project: 24038
Buggy source:
/** 
 * Receives a query request from a client in a local process, and returns a Cursor. This is called internally by the   {@link ContentResolver}. This method can be called from multiple threads, as described in <a href="  {@docRoot}guide/topics/fundamentals.html#procthread">Application Fundamentals: Processes and Threads</a>. <p> Example client call:<p> <pre>// Request a specific record. Cursor managedCursor = managedQuery( Contacts.People.CONTENT_URI.addId(2), projection,    // Which columns to return. null,          // WHERE clause. People.NAME + " ASC");   // Sort order.</pre> Example implementation:<p> <pre>// SQLiteQueryBuilder is a helper class that creates the // proper SQL syntax for us. SQLiteQueryBuilder qBuilder = new SQLiteQueryBuilder(); // Set the table we're querying. qBuilder.setTables(DATABASE_TABLE_NAME); // If the query ends in a specific record number, we're // being asked for a specific record, so set the // WHERE clause in our query. if((URI_MATCHER.match(uri)) == SPECIFIC_MESSAGE){ qBuilder.appendWhere("_id=" + uri.getPathLeafId()); } // Make the query. Cursor c = qBuilder.query(mDb, projection, selection, selectionArgs, groupBy, having, sortOrder); c.setNotificationUri(getContext().getContentResolver(), uri); return c;</pre>
 * @param uri The URI to query. This will be the full URI sent by the client;if the client is requesting a specific record, the URI will end in a record number that the implementation should parse and add to a WHERE or HAVING clause, specifying that _id value.
 * @param projection The list of columns to put into the cursor. Ifnull all columns are included.
 * @param selection A selection criteria to apply when filtering rows.If null then all rows are included.
 * @param sortOrder How the rows in the cursor should be sorted.If null then the provider is free to define the sort order.
 * @return a Cursor or null.
 */
public abstract Cursor query(Uri uri,String[] projection,String selection,String[] selectionArgs,String sortOrder);

Fixed version (ground truth):
/** 
 * Receives a query request from a client in a local process, and returns a Cursor. This is called internally by the   {@link ContentResolver}. This method can be called from multiple threads, as described in <a href="  {@docRoot}guide/topics/fundamentals.html#procthread">Application Fundamentals: Processes and Threads</a>. <p> Example client call:<p> <pre>// Request a specific record. Cursor managedCursor = managedQuery( ContentUris.withAppendedId(Contacts.People.CONTENT_URI, 2), projection,    // Which columns to return. null,          // WHERE clause. null,          // WHERE clause value substitution People.NAME + " ASC");   // Sort order.</pre> Example implementation:<p> <pre>// SQLiteQueryBuilder is a helper class that creates the // proper SQL syntax for us. SQLiteQueryBuilder qBuilder = new SQLiteQueryBuilder(); // Set the table we're querying. qBuilder.setTables(DATABASE_TABLE_NAME); // If the query ends in a specific record number, we're // being asked for a specific record, so set the // WHERE clause in our query. if((URI_MATCHER.match(uri)) == SPECIFIC_MESSAGE){ qBuilder.appendWhere("_id=" + uri.getPathLeafId()); } // Make the query. Cursor c = qBuilder.query(mDb, projection, selection, selectionArgs, groupBy, having, sortOrder); c.setNotificationUri(getContext().getContentResolver(), uri); return c;</pre>
 * @param uri The URI to query. This will be the full URI sent by the client;if the client is requesting a specific record, the URI will end in a record number that the implementation should parse and add to a WHERE or HAVING clause, specifying that _id value.
 * @param projection The list of columns to put into the cursor. Ifnull all columns are included.
 * @param selection A selection criteria to apply when filtering rows.If null then all rows are included.
 * @param selectionArgs You may include ?s in selection, which will be replaced bythe values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings.
 * @param sortOrder How the rows in the cursor should be sorted.If null then the provider is free to define the sort order.
 * @return a Cursor or null.
 */
public abstract Cursor query(Uri uri,String[] projection,String selection,String[] selectionArgs,String sortOrder);