lingochamp / lingochamp/FileDownloader

sofar[17680] not equal total[37111606]问题解决办法进一步请教

Open
#1,252 2 comments 0 reactions 1 assignee View on GitHub

@rantianhua is already working on this.

Since Aug 21, 2019.

question
Dominant language
Java
Stars
11.1k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

问题规律:用户中部分vivo手机,且多为联通宽带下易出现此error回调,部分设备换4G网络后可以正常下载。

Jacksgong前面已经回复同类问题:Occur such exception, because the value of 'content-length' inside the Response-Header is not equal to the real length in the input-stream from the back-end.
并且给出的解决办法是不用管它:
For simple way, you can ignore this error by yourself, because when you get the FileDownloader#error callback with this error message, FileDownloader has already completed fetch all data from the network input stream, and FileDownloader will not delete the downloaded file. So if you receive this error message in error callback, you just do some completed thing you want in it.

那么我应该将 TasksManagerDemoActivity.java中的
protected void error(BaseDownloadTask task, Throwable e) {
super.error(task, e);
final TaskItemViewHolder tag = checkCurrentHolder(task);
if (tag == null) {
return;
}
tag.updateNotDownloaded(FileDownloadStatus.error, task.getLargeFileSoFarBytes()
, task.getLargeFileTotalBytes());
TasksManager.getImpl().removeTaskForViewHolder(task.getId());
}
改成
protected void error(BaseDownloadTask task, Throwable e) {
super.error(task, e);
final TaskItemViewHolder tag = checkCurrentHolder(task);
if (tag == null) {
return;
}

if(e.getMessage().contais("not equal total")){
return;
}
tag.updateNotDownloaded(FileDownloadStatus.error, task.getLargeFileSoFarBytes()
, task.getLargeFileTotalBytes());
TasksManager.getImpl().removeTaskForViewHolder(task.getId());
}
这样就能够解决问题了吗?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.