diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java index f20c6a69..23250a4b 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java @@ -392,10 +392,10 @@ public abstract class AbsFileer tr.endLocation) { + }else if (realLocation > tr.endLocation) { ALog.i(TAG, String.format("分块【%s】错误,将重新开始该分块", temp.getPath())); temp.delete(); tr.startLocation = i * blockLen; diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java index 8cbb23dc..a9f0ded1 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java @@ -18,11 +18,11 @@ package com.arialyy.aria.core.download; import android.support.annotation.CheckResult; import android.support.annotation.NonNull; import android.text.TextUtils; -import android.util.Log; import com.arialyy.aria.core.common.RequestEnum; import com.arialyy.aria.core.delegate.HttpHeaderDelegate; import com.arialyy.aria.core.inf.IHttpHeaderTarget; import com.arialyy.aria.core.manager.TEManager; +import com.arialyy.aria.orm.DbEntity; import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.CommonUtil; import java.io.File; @@ -67,7 +67,6 @@ public class DownloadGroupTarget extends BaseGroupTarget im private void init() { mGroupName = CommonUtil.getMd5Code(mUrls); mTaskEntity = TEManager.getInstance().getGTEntity(DownloadGroupTaskEntity.class, mUrls); - //ALog.d(TAG, "gHash=" + mEntity.getSubEntities().get(0).hashCode() + "; subHash="+mEntity.getT) mEntity = mTaskEntity.getEntity(); if (mEntity != null) { mDirPathTemp = mEntity.getDirPath(); @@ -239,6 +238,11 @@ public class DownloadGroupTarget extends BaseGroupTarget im if (oldFile.exists()) { oldFile.renameTo(new File(newPath)); } + if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=?", newPath)) { + ALog.w(TAG, String.format("更新文件名失败,路径【%s】已存在", newPath)); + return; + } + CommonUtil.modifyTaskRecord(oldFile.getPath(), newPath); entity.setDownloadPath(newPath); taskEntity.setKey(newPath); diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java index e9c75be5..4be6c97f 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java @@ -21,10 +21,13 @@ import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.command.ICmd; import com.arialyy.aria.core.command.normal.CancelCmd; import com.arialyy.aria.core.command.normal.NormalCmdFactory; +import com.arialyy.aria.core.common.TaskRecord; +import com.arialyy.aria.core.download.DownloadGroupEntity; import com.arialyy.aria.core.download.DownloadGroupTaskEntity; import com.arialyy.aria.core.download.DownloadTaskEntity; import com.arialyy.aria.core.manager.TEManager; import com.arialyy.aria.core.upload.UploadTaskEntity; +import com.arialyy.aria.orm.DbEntity; import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.CommonUtil; import java.util.ArrayList; @@ -35,7 +38,7 @@ import java.util.List; */ public abstract class AbsTarget implements ITarget { - protected String TAG ; + protected String TAG; protected ENTITY mEntity; protected TASK_ENTITY mTaskEntity; protected String mTargetName; @@ -64,7 +67,17 @@ public abstract class AbsTarget'`替换为 ``` @@ -100,13 +100,8 @@ protected void onCreate(Bundle savedInstanceState) { ### 版本日志 - + v_3.4.6 - - 修复android 4.4.4 版本多dex下无法进行回调的问题 - - 新增`updateUrl(newUrl)`用于修改任务的url,[see](https://aria.laoyuyu.me/aria_doc/api/task_handle.html#%E6%9B%B4%E6%96%B0%E4%BB%BB%E5%8A%A1url) - - 优化分块下载 - - 修复了字符串中有特殊字符导致的路径冲突问题;修复ftp分块下载失败问题 - - 修复连接中有`+`导致的地址呗使用问题。 - - 修复表重复创建导致的崩溃问题 https://github.com/AriaLyy/Aria/issues/264 + + v_3.4.7 + - 修复分块任务异常操作导致的问题 [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) diff --git a/build.gradle b/build.gradle index 3a3d1e21..2c1ceeb5 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ task clean(type: Delete) { ext { userOrg = 'arialyy' groupId = 'com.arialyy.aria' - publishVersion = '3.4.6' + publishVersion = '3.4.7' // publishVersion = '1.0.3' //FTP插件 repoName='maven' desc = 'android 下载框架'