Program: 162200
Project: 162200
Buggy source:
/** 
 * Downloads a file from VDisk. Returns a   {@link VDiskInputStream} via whichthe file contents can be read from the network. You must close the stream when you're done with it to release all resources. You can also cancel the download by closing the returned {@link VDiskInputStream} at any time.
 * @param path the VDisk path to the file.
 * @param rev the revision (from the file's metadata) of the file to download, or null to get the latest version.
 * @return a {@link VDiskInputStream} from which to read the file contents.The contents are retrieved from the network and not stored locally.
 * @throws VDiskUnlinkedException if you have not set an access token pair on the session, or if the user has revoked access.
 * @throws VDiskServerException if the server responds with an error code. See the constants in  {@link VDiskServerException} for the meaning of each errorcode. The most common error codes you can expect from this call are 404 (path not found) and 400 (bad rev).
 * @throws VDiskIOException if any network-related error occurs.
 * @throws VDiskException for any other unknown errors. This is also a superclass of all other VDisk exceptions, so you may want to only catch this exception which signals that some kind of error occurred.
 */
public VDiskInputStream getFileStream(String path,String rev,File targetFile) throws VDiskException {
  VDiskFileInfo fileInfo=getVDiskFileInfo(path,rev);
  if (fileInfo != null) {
    Entry metadata=fileInfo.metadata;
    String location=fileInfo.downloadURL;
    Log.d(TAG,"String_Node_Str" + location);
    String filename=targetFile.getName().replace(DOWNLOAD_TEMP_FILE_SUFFIX,"String_Node_Str");
    File file=new File(targetFile.getParent(),filename);
    if (file.exists() && file.length() == metadata.bytes) {
      targetFile.delete();
      throw new VDiskDownloadFileExistException();
    }
    RequestAndResponse rp=RESTUtility.streamRequestAndResponse(RequestMethod.GET,session,location,null,getRange(targetFile),metadata.md5,false,-1);
    return new VDiskInputStream(rp.request,rp.response,metadata,location);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Downloads a file from VDisk. Returns a   {@link VDiskInputStream} via whichthe file contents can be read from the network. You must close the stream when you're done with it to release all resources. You can also cancel the download by closing the returned {@link VDiskInputStream} at any time.
 * @param path the VDisk path to the file.
 * @param rev the revision (from the file's metadata) of the file to download, or null to get the latest version.
 * @return a {@link VDiskInputStream} from which to read the file contents.The contents are retrieved from the network and not stored locally.
 * @throws VDiskUnlinkedException if you have not set an access token pair on the session, or if the user has revoked access.
 * @throws VDiskServerException if the server responds with an error code. See the constants in  {@link VDiskServerException} for the meaning of each errorcode. The most common error codes you can expect from this call are 404 (path not found) and 400 (bad rev).
 * @throws VDiskIOException if any network-related error occurs.
 * @throws VDiskException for any other unknown errors. This is also a superclass of all other VDisk exceptions, so you may want to only catch this exception which signals that some kind of error occurred.
 */
public VDiskInputStream getFileStream(String path,String rev,File targetFile) throws VDiskException {
  VDiskFileInfo fileInfo=getVDiskFileInfo(path,rev);
  if (fileInfo != null) {
    Entry metadata=fileInfo.metadata;
    String location=fileInfo.downloadURL;
    Log.d(TAG,"String_Node_Str" + location);
    String filename=targetFile.getName().replace(DOWNLOAD_TEMP_FILE_SUFFIX,"String_Node_Str");
    File file=new File(targetFile.getParent(),filename);
    if (file.exists() && file.length() == metadata.bytes) {
      targetFile.delete();
      throw new VDiskDownloadFileExistException();
    }
    RequestAndResponse rp=RESTUtility.streamRequestAndResponse(RequestMethod.GET,session,location,null,getRange(targetFile),metadata.md5,false,-1,true);
    return new VDiskInputStream(rp.request,rp.response,metadata,location);
  }
  return null;
}