Program: 193652
Project: 193652
Buggy source:
/** 
 * Handles copying a single file.
 * @param srcUri URI of the file to copy from.
 * @param dstUri URI of the *file* to copy to. Must be created beforehand.
 * @throws RemoteException
 */
private void copyFileHelper(Uri srcUri,Uri dstUri,int mode) throws RemoteException {
  CancellationSignal canceller=new CancellationSignal();
  ParcelFileDescriptor srcFile=null;
  ParcelFileDescriptor dstFile=null;
  InputStream src=null;
  OutputStream dst=null;
  IOException copyError=null;
  try {
    srcFile=mSrcClient.openFile(srcUri,"String_Node_Str",canceller);
    dstFile=mDstClient.openFile(dstUri,"String_Node_Str",canceller);
    src=new ParcelFileDescriptor.AutoCloseInputStream(srcFile);
    dst=new ParcelFileDescriptor.AutoCloseOutputStream(dstFile);
    byte[] buffer=new byte[8192];
    int len;
    while (!mIsCancelled && ((len=src.read(buffer)) != -1)) {
      dst.write(buffer,0,len);
      makeProgress(len);
    }
    srcFile.checkError();
  }
 catch (  IOException e) {
    copyError=e;
    try {
      dstFile.closeWithError(copyError.getMessage());
    }
 catch (    IOException closeError) {
      Log.e(TAG,"String_Node_Str",closeError);
    }
  }
 finally {
    IoUtils.closeQuietly(src);
    IoUtils.closeQuietly(dst);
  }
  if (copyError != null) {
    Log.e(TAG,"String_Node_Str" + srcUri.toString(),copyError);
    try {
      mFailedFiles.add(DocumentInfo.fromUri(getContentResolver(),srcUri));
    }
 catch (    FileNotFoundException ignore) {
      Log.w(TAG,"String_Node_Str" + srcUri,copyError);
    }
  }
  if (copyError != null || mIsCancelled) {
    canceller.cancel();
    try {
      DocumentsContract.deleteDocument(mDstClient,dstUri);
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str" + dstUri,e);
      throw e;
    }
  }
 else   if (mode == TRANSFER_MODE_MOVE) {
    try {
      DocumentsContract.deleteDocument(mSrcClient,srcUri);
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str" + srcUri,e);
      throw e;
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles copying a single file.
 * @param srcUri URI of the file to copy from.
 * @param dstUri URI of the *file* to copy to. Must be created beforehand.
 * @throws RemoteException
 */
private void copyFileHelper(Uri srcUri,Uri dstUri,int mode) throws RemoteException {
  CancellationSignal canceller=new CancellationSignal();
  ParcelFileDescriptor srcFile=null;
  ParcelFileDescriptor dstFile=null;
  InputStream src=null;
  OutputStream dst=null;
  IOException copyError=null;
  try {
    srcFile=mSrcClient.openFile(srcUri,"String_Node_Str",canceller);
    dstFile=mDstClient.openFile(dstUri,"String_Node_Str",canceller);
    src=new ParcelFileDescriptor.AutoCloseInputStream(srcFile);
    dst=new ParcelFileDescriptor.AutoCloseOutputStream(dstFile);
    byte[] buffer=new byte[8192];
    int len;
    while (!mIsCancelled && ((len=src.read(buffer)) != -1)) {
      dst.write(buffer,0,len);
      makeProgress(len);
    }
    srcFile.checkError();
  }
 catch (  IOException e) {
    copyError=e;
    try {
      DocumentInfo info=DocumentInfo.fromUri(getContentResolver(),srcUri);
      mFailedFiles.add(info);
      Log.e(TAG,"String_Node_Str" + info.displayName + "String_Node_Str"+ info.derivedUri+ "String_Node_Str",copyError);
    }
 catch (    FileNotFoundException ignore) {
      DocumentInfo info=new DocumentInfo();
      info.derivedUri=srcUri;
      info.displayName="String_Node_Str" + srcUri + "String_Node_Str";
      mFailedFiles.add(info);
      Log.e(TAG,"String_Node_Str" + srcUri,copyError);
    }
    if (dstFile != null) {
      try {
        dstFile.closeWithError(copyError.getMessage());
      }
 catch (      IOException closeError) {
        Log.e(TAG,"String_Node_Str",closeError);
      }
    }
  }
 finally {
    IoUtils.closeQuietly(src);
    IoUtils.closeQuietly(dst);
  }
  if (copyError != null || mIsCancelled) {
    canceller.cancel();
    try {
      DocumentsContract.deleteDocument(mDstClient,dstUri);
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str" + dstUri,e);
      throw e;
    }
  }
 else   if (mode == TRANSFER_MODE_MOVE) {
    try {
      DocumentsContract.deleteDocument(mSrcClient,srcUri);
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str" + srcUri,e);
      throw e;
    }
  }
}