Program: 2780
Project: 2780
Buggy source:
/** 
 * This is like   {@link #openFile}, but can be implemented by providers that need to be able to return sub-sections of files, often assets inside of their .apk. This method can be called from multiple threads, as described in <a href="  {@docRoot}guide/topics/fundamentals/processes-and-threads.html#Threads">Processes and Threads</a>. <p>If you implement this, your clients must be able to deal with such file slices, either directly with  {@link ContentResolver#openAssetFileDescriptor}, or by using the higher-level  {@link ContentResolver#openInputStream ContentResolver.openInputStream}or   {@link ContentResolver#openOutputStream ContentResolver.openOutputStream}methods. <p class="note">If you are implementing this to return a full file, you should create the AssetFileDescriptor with  {@link AssetFileDescriptor#UNKNOWN_LENGTH} to be compatible withapplications that can not handle sub-sections of files.</p>
 * @param uri The URI whose file is to be opened.
 * @param mode Access mode for the file.  May be "r" for read-only access,"w" for write-only access (erasing whatever data is currently in the file), "wa" for write-only access to append to any existing data, "rw" for read and write access on any existing data, and "rwt" for read and write access that truncates any existing file.
 * @return Returns a new AssetFileDescriptor which you can use to accessthe file.
 * @throws FileNotFoundException Throws FileNotFoundException if there isno file associated with the given URI or the mode is invalid.
 * @throws SecurityException Throws SecurityException if the caller doesnot have permission to access the file.
 * @see #openFile(Uri,String)
 * @see #openFileHelper(Uri,String)
 */
public AssetFileDescriptor openAssetFile(Uri uri,String mode) throws FileNotFoundException {
  ParcelFileDescriptor fd=openFile(uri,mode);
  return fd != null ? new AssetFileDescriptor(fd,0,-1) : null;
}

Fixed version (ground truth):
/** 
 * This is like   {@link #openFile}, but can be implemented by providers that need to be able to return sub-sections of files, often assets inside of their .apk. This method can be called from multiple threads, as described in <a href="  {@docRoot}guide/topics/fundamentals/processes-and-threads.html#Threads">Processes and Threads</a>. <p>If you implement this, your clients must be able to deal with such file slices, either directly with  {@link ContentResolver#openAssetFileDescriptor}, or by using the higher-level  {@link ContentResolver#openInputStream ContentResolver.openInputStream}or   {@link ContentResolver#openOutputStream ContentResolver.openOutputStream}methods. <p class="note">If you are implementing this to return a full file, you should create the AssetFileDescriptor with  {@link AssetFileDescriptor#UNKNOWN_LENGTH} to be compatible withapplications that can not handle sub-sections of files.</p> <p class="note">For use in Intents, you will want to implement  {@link #getType}to return the appropriate MIME type for the data returned here with the same URI.  This will allow intent resolution to automatically determine the data MIME type and select the appropriate matching targets as part of its operation.</p> <p class="note">For better interoperability with other applications, it is recommended that for any URIs that can be opened, you also support queries on them containing at least the columns specified by   {@link android.provider.OpenableColumns}.</p>
 * @param uri The URI whose file is to be opened.
 * @param mode Access mode for the file.  May be "r" for read-only access,"w" for write-only access (erasing whatever data is currently in the file), "wa" for write-only access to append to any existing data, "rw" for read and write access on any existing data, and "rwt" for read and write access that truncates any existing file.
 * @return Returns a new AssetFileDescriptor which you can use to accessthe file.
 * @throws FileNotFoundException Throws FileNotFoundException if there isno file associated with the given URI or the mode is invalid.
 * @throws SecurityException Throws SecurityException if the caller doesnot have permission to access the file.
 * @see #openFile(Uri,String)
 * @see #openFileHelper(Uri,String)
 * @see #getType(android.net.Uri)
 */
public AssetFileDescriptor openAssetFile(Uri uri,String mode) throws FileNotFoundException {
  ParcelFileDescriptor fd=openFile(uri,mode);
  return fd != null ? new AssetFileDescriptor(fd,0,-1) : null;
}