From 023f648d07e91c98e09c90ac98cfa1ba48333e84 Mon Sep 17 00:00:00 2001
From: laoyuyu <511455842@qq.com>
Date: Fri, 26 Jun 2020 15:53:28 +0800
Subject: [PATCH] fix bug https://github.com/AriaLyy/Aria/issues/695
---
.../aria/core/manager/SubTaskManager.java | 2 +-
DEV_LOG.md | 4 ++-
.../arialyy/aria/core/loader/SubLoader.java | 10 +++---
.../arialyy/aria/core/task/ThreadTask.java | 34 +++++++++----------
README.md | 30 ++++++++--------
app/src/main/assets/aria_config.xml | 2 +-
.../core/download/HttpDownloadModule.java | 2 +-
.../core/download/SingleTaskActivity.java | 2 +-
.../arialyy/simple/widget/ProgressLayout.java | 2 +-
build.gradle | 4 +--
10 files changed, 47 insertions(+), 45 deletions(-)
diff --git a/Aria/src/main/java/com/arialyy/aria/core/manager/SubTaskManager.java b/Aria/src/main/java/com/arialyy/aria/core/manager/SubTaskManager.java
index 98490257..ce1bc716 100644
--- a/Aria/src/main/java/com/arialyy/aria/core/manager/SubTaskManager.java
+++ b/Aria/src/main/java/com/arialyy/aria/core/manager/SubTaskManager.java
@@ -28,7 +28,7 @@ import java.util.List;
* 子任务管理器
*/
public class SubTaskManager {
- private String TAG = "SubTaskManager";
+ private final String TAG = getClass().getSimpleName();
private DGTaskWrapper mEntity;
public SubTaskManager(DGTaskWrapper entity) {
diff --git a/DEV_LOG.md b/DEV_LOG.md
index bc2e16bc..46ad883e 100644
--- a/DEV_LOG.md
+++ b/DEV_LOG.md
@@ -1,6 +1,8 @@
## 开发日志
- + v_3.8.10
+ + v_3.8.10 (2020/6/26)
- fix bug https://github.com/AriaLyy/Aria/issues/703
+ - fix bug https://github.com/AriaLyy/Aria/issues/702
+ - fix bug https://github.com/AriaLyy/Aria/issues/695
+ v_3.8.9 (2020/6/14)
- fix bug https://github.com/AriaLyy/Aria/issues/688
- fix bug https://github.com/AriaLyy/Aria/issues/690
diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java b/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java
index 81232ac0..2d6a2825 100644
--- a/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java
+++ b/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java
@@ -106,7 +106,7 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
}
record = recordHandler.getRecord(wrapper.getEntity().getFileSize());
- if (record == null){
+ if (record == null) {
ALog.d(TAG, "子任务记录为空");
sendFailState(false);
return;
@@ -168,9 +168,9 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
for (IThreadTask iThreadTask : mTask) {
iThreadTask.call();
}
- } else {
- ALog.e(TAG, "子任务的线程任务为空");
+ return;
}
+ ALog.e(TAG, "子任务的线程任务为空");
} catch (Exception e) {
e.printStackTrace();
}
@@ -263,9 +263,9 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
}
if (needGetInfo) {
infoTask.run();
- } else {
- handlerTask();
+ return;
}
+ handlerTask();
}
/**
diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/task/ThreadTask.java b/PublicComponent/src/main/java/com/arialyy/aria/core/task/ThreadTask.java
index 737cf228..f5097e87 100644
--- a/PublicComponent/src/main/java/com/arialyy/aria/core/task/ThreadTask.java
+++ b/PublicComponent/src/main/java/com/arialyy/aria/core/task/ThreadTask.java
@@ -402,16 +402,18 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
if (mTaskWrapper.getRequestType() == ITaskWrapper.M3U8_VOD) {
writeConfig(false, 0);
retryM3U8Peer(needRetry);
- } else {
- if (mTaskWrapper.isSupportBP()) {
- writeConfig(false, subCurrentLocation);
- retryBlockTask(needRetry && mConfig.startThreadNum != 1);
- } else {
- ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
- ErrorHelp.saveError("", ALog.getExceptionString(ex));
- sendFailMsg(null, needRetry);
- }
+ return;
+ }
+
+ if (mTaskWrapper.isSupportBP()) {
+ writeConfig(false, subCurrentLocation);
+ retryBlockTask(needRetry);
+ return;
}
+
+ ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
+ ErrorHelp.saveError("", ALog.getExceptionString(ex));
+ sendFailMsg(null, needRetry);
}
/**
@@ -432,9 +434,9 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
FileUtil.deleteFile(mConfig.tempFile);
FileUtil.createFile(mConfig.tempFile);
ThreadTaskManager.getInstance().retryThread(this);
- } else {
- sendFailMsg(null, false);
+ return;
}
+ sendFailMsg(null, false);
}
/**
@@ -454,10 +456,10 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
mFailTimes++;
handleBlockRecord();
ThreadTaskManager.getInstance().retryThread(this);
- } else {
- ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
- sendFailMsg(null, needRetry);
+ return;
}
+ ALog.e(TAG, String.format("任务【%s】执行失败", getFileName()));
+ sendFailMsg(null, needRetry);
}
/**
@@ -509,10 +511,8 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
b.putBoolean(IThreadStateManager.DATA_RETRY, needRetry);
if (e != null) {
b.putSerializable(IThreadStateManager.DATA_ERROR_INFO, e);
- updateState(IThreadStateManager.STATE_FAIL, b);
- } else {
- updateState(IThreadStateManager.STATE_FAIL, b);
}
+ updateState(IThreadStateManager.STATE_FAIL, b);
}
/**
diff --git a/README.md b/README.md
index 975f8c68..bf2ae4f7 100644
--- a/README.md
+++ b/README.md
@@ -45,19 +45,19 @@ Aria有以下特点:
## 引入库
[![license](http://img.shields.io/badge/license-Apache2.0-brightgreen.svg?style=flat)](https://github.com/AriaLyy/Aria/blob/master/LICENSE)
-[![Core](https://img.shields.io/badge/Core-3.8.9-blue)](https://github.com/AriaLyy/Aria)
-[![Compiler](https://img.shields.io/badge/Compiler-3.8.9-blue)](https://github.com/AriaLyy/Aria)
-[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.9-orange)](https://github.com/AriaLyy/Aria)
-[![FtpComponent](https://img.shields.io/badge/SFtpComponent-3.8.9-orange)](https://github.com/AriaLyy/Aria)
-[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.9-orange)](https://github.com/AriaLyy/Aria)
+[![Core](https://img.shields.io/badge/Core-3.8.10-blue)](https://github.com/AriaLyy/Aria)
+[![Compiler](https://img.shields.io/badge/Compiler-3.8.10-blue)](https://github.com/AriaLyy/Aria)
+[![FtpComponent](https://img.shields.io/badge/FtpComponent-3.8.10-orange)](https://github.com/AriaLyy/Aria)
+[![FtpComponent](https://img.shields.io/badge/SFtpComponent-3.8.10-orange)](https://github.com/AriaLyy/Aria)
+[![M3U8Component](https://img.shields.io/badge/M3U8Component-3.8.10-orange)](https://github.com/AriaLyy/Aria)
```java
-implementation 'com.arialyy.aria:core:3.8.9'
-annotationProcessor 'com.arialyy.aria:compiler:3.8.9'
-implementation 'com.arialyy.aria:ftpComponent:3.8.9' # 如果需要使用ftp,请增加该组件
-implementation 'com.arialyy.aria:sftpComponent:3.8.9' # 如果需要使用ftp,请增加该组件
-implementation 'com.arialyy.aria:m3u8Component:3.8.9' # 如果需要使用m3u8下载功能,请增加该组件
+implementation 'com.arialyy.aria:core:3.8.10'
+annotationProcessor 'com.arialyy.aria:compiler:3.8.10'
+implementation 'com.arialyy.aria:ftpComponent:3.8.10' # 如果需要使用ftp,请增加该组件
+implementation 'com.arialyy.aria:sftpComponent:3.8.10' # 如果需要使用ftp,请增加该组件
+implementation 'com.arialyy.aria:m3u8Component:3.8.10' # 如果需要使用m3u8下载功能,请增加该组件
```
如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html)
@@ -138,10 +138,10 @@ protected void onCreate(Bundle savedInstanceState) {
### 版本日志
- + v_3.8.9 (2020/6/14)
- - fix bug https://github.com/AriaLyy/Aria/issues/688
- - fix bug https://github.com/AriaLyy/Aria/issues/690
- - m3u8任务增加`setUseDefConvert()`方法,用于处理默认的m3u8任务
+ + v_3.8.10 (2020/6/26)
+ - fix bug https://github.com/AriaLyy/Aria/issues/703
+ - fix bug https://github.com/AriaLyy/Aria/issues/702
+ - fix bug https://github.com/AriaLyy/Aria/issues/695
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
@@ -171,7 +171,7 @@ protected void onCreate(Bundle savedInstanceState) {
在提交问题前,希望你已经查看过[wiki](https://aria.laoyuyu.me/aria_doc/)或搜索过[issues](https://github.com/AriaLyy/Aria/issues)。
## 打赏
- 如果觉得框架写的不错并且帮助到了你,可以请我喝杯热茶。`^_^`
+ 如果觉得框架写的不错并且帮助到了你,可以请我瓶快乐水。`^_^`
diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml
index 06b96f8a..26922e63 100644
--- a/app/src/main/assets/aria_config.xml
+++ b/app/src/main/assets/aria_config.xml
@@ -41,7 +41,7 @@
3、从3.4.1开始,如果线程数为1,文件初始化时将不再预占用对应长度的空间,下载多少byte,则占多大的空间;
对于采用多线程的任务或旧任务,依然采用原来的文件空间占用方式;
-->
-
+
diff --git a/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java b/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java
index 153f280d..7674964e 100644
--- a/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java
+++ b/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java
@@ -58,7 +58,7 @@ public class HttpDownloadModule extends BaseViewModule {
//String url = "https://imtt.dd.qq.com/16891/apk/70BFFDB05AB8686F2A4CF3E07588A377.apk?fsname=com.tencent.tmgp.speedmobile_1.16.0.33877_1160033877.apk&csr=1bbd";
//String url = "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a9e671b9a551f3dedcb2bf64a4eff0ec/4610b912c8fcc3cef70d70409845d688d53f20f7.jpg";
//String filePath = AppUtil.getConfigValue(context, HTTP_PATH_KEY, defFilePath);
- String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip1";
+ String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip";
//String url = "https://video-hkt1-1.xx.fbcdn.net/v/t42.9040-2/89465702_658301101378505_5469280744218034176_n.mp4?_nc_cat=107&_nc_sid=985c63&efg=eyJ2ZW5jb2RlX3RhZyI6ImxlZ2FjeV9zZCJ9&_nc_oc=AQmzYwQG9vccyqr7S44-cfHc4wJ9010O1nvspG2DPV4cTct1pLrjKl1e1UmOJV99bJw&_nc_ht=video-hkt1-1.xx&oh=49bd04435aaa8b4459b8d5cb7d1e7c79&oe=5E672E37";
//String url = "http://donuts.aigauss.com/doc_fPhW2DBGj3_1578932414.png";
String filePath = "/mnt/sdcard/update.mp4";
diff --git a/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java b/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java
index 07dfa81b..d9c9acb7 100644
--- a/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java
+++ b/app/src/main/java/com/arialyy/simple/core/download/SingleTaskActivity.java
@@ -190,7 +190,7 @@ public class SingleTaskActivity extends BaseActivity {
@Download.onTaskRunning
protected void running(DownloadTask task) {
if (task.getKey().equals(mUrl)) {
- ALog.d(TAG, "isRunning" + "; state = " + task.getEntity().getState());
+ //ALog.d(TAG, "isRunning" + "; state = " + task.getEntity().getState());
getBinding().pl.setInfo(task.getEntity());
}
}
diff --git a/app/src/main/java/com/arialyy/simple/widget/ProgressLayout.java b/app/src/main/java/com/arialyy/simple/widget/ProgressLayout.java
index 1e255406..1e1ee8d8 100644
--- a/app/src/main/java/com/arialyy/simple/widget/ProgressLayout.java
+++ b/app/src/main/java/com/arialyy/simple/widget/ProgressLayout.java
@@ -157,7 +157,7 @@ public class ProgressLayout extends RelativeLayout implements View.OnClickListen
this.currentState = entity.getState();
if (entity instanceof AbsNormalEntity) {
AbsNormalEntity normalEntity = (AbsNormalEntity) entity;
- ALog.d(TAG, "fileName = " + ((AbsNormalEntity) entity).getFileName());
+ //ALog.d(TAG, "fileName = " + ((AbsNormalEntity) entity).getFileName());
fileName.setText(normalEntity.getFileName());
} else if (entity instanceof AbsGroupEntity) {
AbsGroupEntity groupEntity = (AbsGroupEntity) entity;
diff --git a/build.gradle b/build.gradle
index 6c41b4b0..34132520 100644
--- a/build.gradle
+++ b/build.gradle
@@ -44,8 +44,8 @@ task clean(type: Delete) {
}
ext {
- versionCode = 389
- versionName = '3.8.9'
+ versionCode = 390
+ versionName = '3.8.10'
userOrg = 'arialyy'
groupId = 'com.arialyy.aria'
publishVersion = versionName