修正404 url导致的卡顿问题

This commit is contained in:
AriaLyy committed 2017-03-07 09:53:26 +08:00
1 parent f479b809b5
commit c03d119b56
2 files changed
+5 -1

No files matched your search

@@ -225,8 +225,11 @@ final class DownloadUtil implements IDownloadUtil, Runnable {
mListener.supportBreakpoint(false); mListener.supportBreakpoint(false);
Log.w(TAG, "该下载链接不支持断点下载"); Log.w(TAG, "该下载链接不支持断点下载");
handleBreakpoint(conn); handleBreakpoint(conn);
} else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
Log.w(TAG, "任务【" + mDownloadEntity.getDownloadUrl() + "】下载失败,错误码:404");
mListener.onCancel();
} else { } else {
failDownload("任务【" + mDownloadEntity.getDownloadUrl() + "】下载失败,返回码:" + code); failDownload("任务【" + mDownloadEntity.getDownloadUrl() + "】下载失败,错误码:" + code);
} }
} catch (IOException e) { } catch (IOException e) {
failDownload("下载失败【downloadUrl:" failDownload("下载失败【downloadUrl:"
@@ -216,6 +216,7 @@ final class UploadUtil implements Runnable {
mHttpConn.disconnect(); mHttpConn.disconnect();
} else { } else {
Log.w(TAG, "state_code = " + status); Log.w(TAG, "state_code = " + status);
mListener.onFail();
} }
writer.flush(); writer.flush();