@@ -30,7 +30,7 @@ import com.arialyy.aria.core.loader.ILoaderVisitor;
|
||||
import com.arialyy.aria.core.loader.IRecordHandler;
|
||||
import com.arialyy.aria.core.loader.IThreadTaskBuilder;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
import java.io.File;
|
||||
@@ -321,7 +321,7 @@ public abstract class AbsGroupLoader implements ILoaderVisitor, ILoader {
|
||||
}
|
||||
}
|
||||
|
||||
protected void fail(BaseException e, boolean needRetry){
|
||||
protected void fail(AriaException e, boolean needRetry){
|
||||
closeTimer();
|
||||
getListener().onFail(needRetry, e);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.arialyy.aria.core.config.Configuration;
|
||||
import com.arialyy.aria.core.inf.IThreadStateManager;
|
||||
import com.arialyy.aria.core.loader.IRecordHandler;
|
||||
import com.arialyy.aria.core.manager.ThreadTaskManager;
|
||||
import com.arialyy.aria.exception.TaskException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
import com.arialyy.aria.util.NetUtils;
|
||||
@@ -113,7 +113,7 @@ final class SimpleSchedulers implements Handler.Callback {
|
||||
|| loaderUtil.getLoader() == null // 如果获取不到文件信息,loader为空
|
||||
|| loaderUtil.getEntity().getFailNum() > num) {
|
||||
mQueue.removeTaskFromExecQ(loaderUtil);
|
||||
mGState.listener.onSubFail(loaderUtil.getEntity(), new TaskException(TAG,
|
||||
mGState.listener.onSubFail(loaderUtil.getEntity(), new AriaException(TAG,
|
||||
String.format("任务组子任务【%s】下载失败,下载地址【%s】", loaderUtil.getEntity().getFileName(),
|
||||
loaderUtil.getEntity().getUrl())));
|
||||
mGState.countFailNum(loaderUtil.getKey());
|
||||
@@ -122,7 +122,7 @@ final class SimpleSchedulers implements Handler.Callback {
|
||||
== mGState.getSubSize()) {
|
||||
mQueue.clear();
|
||||
mGState.isRunning = false;
|
||||
mGState.listener.onFail(false, new TaskException(TAG,
|
||||
mGState.listener.onFail(false, new AriaException(TAG,
|
||||
String.format("任务组【%s】下载失败", mGState.getGroupHash())));
|
||||
} else {
|
||||
startNext();
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
package com.arialyy.aria.core.listener;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import com.arialyy.aria.core.common.AbsEntity;
|
||||
import com.arialyy.aria.core.inf.IEntity;
|
||||
import com.arialyy.aria.core.inf.TaskSchedulerType;
|
||||
import com.arialyy.aria.core.task.AbsTask;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
import com.arialyy.aria.util.ErrorHelp;
|
||||
@@ -114,7 +115,7 @@ public abstract class BaseListener<ENTITY extends AbsEntity, TASK_WRAPPER extend
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onFail(boolean needRetry, BaseException e) {
|
||||
@Override public void onFail(boolean needRetry, AriaException e) {
|
||||
mEntity.setFailNum(mEntity.getFailNum() + 1);
|
||||
saveData(IEntity.STATE_FAIL, mEntity.getCurrentProgress());
|
||||
handleSpeed(0);
|
||||
@@ -123,8 +124,8 @@ public abstract class BaseListener<ENTITY extends AbsEntity, TASK_WRAPPER extend
|
||||
sendInState2Target(ISchedulers.FAIL);
|
||||
if (e != null) {
|
||||
String error = ALog.getExceptionString(e);
|
||||
ALog.w(TAG, error);
|
||||
ErrorHelp.saveError(e.getTag(), "", error);
|
||||
ALog.e(TAG, error);
|
||||
ErrorHelp.saveError(e.getTag(), e.getMessage(), error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.arialyy.aria.core.inf.IEntity;
|
||||
import com.arialyy.aria.core.inf.TaskSchedulerType;
|
||||
import com.arialyy.aria.core.task.AbsTask;
|
||||
import com.arialyy.aria.core.task.DownloadGroupTask;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
import com.arialyy.aria.util.ErrorHelp;
|
||||
@@ -81,7 +81,7 @@ public class DownloadGroupListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubFail(DownloadEntity subEntity, BaseException e) {
|
||||
public void onSubFail(DownloadEntity subEntity, AriaException e) {
|
||||
handleSubSpeed(subEntity, 0);
|
||||
saveSubState(IEntity.STATE_FAIL, subEntity);
|
||||
saveCurrentLocation();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.arialyy.aria.core.listener;
|
||||
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
|
||||
/**
|
||||
* Created by Aria.Lao on 2017/7/20.
|
||||
@@ -54,7 +54,7 @@ public interface IDGroupListener extends IDLoadListener {
|
||||
/**
|
||||
* 子任务下载失败
|
||||
*/
|
||||
void onSubFail(DownloadEntity subEntity, BaseException e);
|
||||
void onSubFail(DownloadEntity subEntity, AriaException e);
|
||||
|
||||
/**
|
||||
* 子任务取消下载
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.arialyy.aria.core.listener;
|
||||
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
|
||||
/**
|
||||
* Created by Aria.Lao on 2017/7/18.
|
||||
@@ -64,5 +64,5 @@ public interface IEventListener {
|
||||
* @param needRetry 是否需要重试{@code true} 需要
|
||||
* @param e 失败信息
|
||||
*/
|
||||
void onFail(boolean needRetry, BaseException e);
|
||||
void onFail(boolean needRetry, AriaException e);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.arialyy.aria.core.loader;
|
||||
import com.arialyy.aria.core.inf.IUtil;
|
||||
import com.arialyy.aria.core.listener.IEventListener;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
|
||||
@@ -135,7 +135,7 @@ public abstract class AbsNormalLoaderUtil implements IUtil {
|
||||
return mListener;
|
||||
}
|
||||
|
||||
protected void fail(BaseException e, boolean needRetry) {
|
||||
protected void fail(AriaException e, boolean needRetry) {
|
||||
if (isStop || isCancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.arialyy.aria.core.loader;
|
||||
|
||||
import com.arialyy.aria.core.common.AbsEntity;
|
||||
import com.arialyy.aria.core.common.CompleteInfo;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
|
||||
/**
|
||||
* 任务信息采集
|
||||
@@ -47,6 +47,6 @@ public interface IInfoTask extends ILoaderComponent {
|
||||
*
|
||||
* @param e 错误信息
|
||||
*/
|
||||
void onFail(AbsEntity entity, BaseException e, boolean needRetry);
|
||||
void onFail(AbsEntity entity, AriaException e, boolean needRetry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.arialyy.aria.core.listener.IEventListener;
|
||||
import com.arialyy.aria.core.manager.ThreadTaskManager;
|
||||
import com.arialyy.aria.core.task.IThreadTask;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.FileUtil;
|
||||
import java.io.File;
|
||||
|
||||
@@ -150,7 +150,7 @@ public class NormalLoader<T extends AbsTaskWrapper> extends AbsNormalLoader<T> {
|
||||
startThreadTask();
|
||||
}
|
||||
|
||||
@Override public void onFail(AbsEntity entity, BaseException e, boolean needRetry) {
|
||||
@Override public void onFail(AbsEntity entity, AriaException e, boolean needRetry) {
|
||||
getListener().onFail(needRetry, e);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ import android.os.Message;
|
||||
import com.arialyy.aria.core.TaskRecord;
|
||||
import com.arialyy.aria.core.inf.IThreadStateManager;
|
||||
import com.arialyy.aria.core.listener.IEventListener;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.FileUtil;
|
||||
import java.io.File;
|
||||
@@ -91,7 +91,7 @@ public class NormalThreadStateManager implements IThreadStateManager {
|
||||
if (isFail()) {
|
||||
Bundle b = msg.getData();
|
||||
mListener.onFail(b.getBoolean(DATA_RETRY, false),
|
||||
(BaseException) b.getSerializable(DATA_ERROR_INFO));
|
||||
(AriaException) b.getSerializable(DATA_ERROR_INFO));
|
||||
quitLooper();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.arialyy.aria.core.manager.ThreadTaskManager;
|
||||
import com.arialyy.aria.core.task.IThreadTask;
|
||||
import com.arialyy.aria.core.task.ThreadTask;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
import java.io.File;
|
||||
@@ -207,7 +207,7 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
|
||||
handlerTask();
|
||||
}
|
||||
|
||||
@Override public void onFail(AbsEntity entity, BaseException e, boolean needRetry) {
|
||||
@Override public void onFail(AbsEntity entity, AriaException e, boolean needRetry) {
|
||||
sendFailState(needRetry);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -255,7 +255,7 @@ public class ThreadTaskManager {
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ALog.e(TAG, e);
|
||||
ALog.e(TAG, "", e);
|
||||
return;
|
||||
}
|
||||
mExePool.submit(task);
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.arialyy.aria.core.ThreadRecord;
|
||||
import com.arialyy.aria.core.common.SubThreadConfig;
|
||||
import com.arialyy.aria.core.config.BaseTaskConfig;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.BandwidthLimiter;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
|
||||
@@ -110,7 +110,7 @@ public abstract class AbsThreadTaskAdapter implements IThreadTaskAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
protected void fail(BaseException ex, boolean needRetry) {
|
||||
protected void fail(AriaException ex, boolean needRetry) {
|
||||
if (mObserver != null) {
|
||||
mObserver.updateFailState(ex, needRetry);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.arialyy.aria.core.task;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.arialyy.aria.core.inf.IThreadStateManager;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
|
||||
/**
|
||||
* 线程任务观察者
|
||||
@@ -44,7 +44,7 @@ public interface IThreadTaskObserver {
|
||||
*
|
||||
* @param needRetry 是否需要重试,一般是网络错误才需要重试
|
||||
*/
|
||||
void updateFailState(BaseException e, boolean needRetry);
|
||||
void updateFailState(AriaException e, boolean needRetry);
|
||||
|
||||
/**
|
||||
* 更新进度
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.arialyy.aria.core.listener.ISchedulers;
|
||||
import com.arialyy.aria.core.manager.ThreadTaskManager;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.core.wrapper.ITaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.BufferedRandomAccessFile;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
@@ -323,7 +323,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
*
|
||||
* @param needRetry 是否需要重试,一般是网络错误才需要重试
|
||||
*/
|
||||
@Override public synchronized void updateFailState(BaseException e, boolean needRetry) {
|
||||
@Override public synchronized void updateFailState(AriaException e, boolean needRetry) {
|
||||
fail(mRangeProgress, e, needRetry);
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
*
|
||||
* @param subCurrentLocation 当前子线程进度
|
||||
*/
|
||||
protected void fail(final long subCurrentLocation, BaseException ex, boolean needRetry) {
|
||||
protected void fail(final long subCurrentLocation, AriaException ex, boolean needRetry) {
|
||||
if (ex != null) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@@ -505,7 +505,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
/**
|
||||
* 发送失败信息
|
||||
*/
|
||||
private void sendFailMsg(BaseException e, boolean needRetry) {
|
||||
private void sendFailMsg(AriaException e, boolean needRetry) {
|
||||
Bundle b = new Bundle();
|
||||
b.putBoolean(IThreadStateManager.DATA_RETRY, needRetry);
|
||||
if (e != null) {
|
||||
|
||||
@@ -15,14 +15,22 @@
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
public class AriaException extends BaseException {
|
||||
private static final String ARIA_NET_EXCEPTION = "Aria Exception:";
|
||||
public class AriaException extends Exception {
|
||||
|
||||
private String tag;
|
||||
|
||||
public AriaException(String tag, String message) {
|
||||
super(tag, String.format("%s%s", ARIA_NET_EXCEPTION, message));
|
||||
super(message);
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public AriaException(String tag, String message, Exception e) {
|
||||
super(tag, message, e);
|
||||
super(String.format("%s, %s\n%s", tag, message == null ? "" : message,
|
||||
e == null ? "" : e.getMessage()));
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
public class M3U8Exception extends BaseException{
|
||||
private static final String M3U8_EXCEPTION = "M3U8 Exception:";
|
||||
public class AriaFTPException extends AriaException {
|
||||
private static final String FTP_EXCEPTION = "Aria SFTP Exception:";
|
||||
|
||||
public M3U8Exception(String tag, String message) {
|
||||
super(tag, String.format("%s%s", M3U8_EXCEPTION, message));
|
||||
public AriaFTPException(String tag, String message) {
|
||||
super(tag, String.format("%s\n%s", FTP_EXCEPTION, message));
|
||||
}
|
||||
|
||||
public M3U8Exception(String tag, String message, Exception e){
|
||||
public AriaFTPException(String tag, String message, Exception e) {
|
||||
super(tag, message, e);
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
public class AriaLoginException extends BaseException{
|
||||
private static final String ARIA_NET_EXCEPTION = "Aria Login Exception:";
|
||||
public class AriaHTTPException extends AriaException {
|
||||
private static final String HTTP_EXCEPTION = "Aria HTTP Exception:";
|
||||
|
||||
public AriaLoginException(String tag, String message) {
|
||||
super(tag, String.format("%s%s", ARIA_NET_EXCEPTION, message));
|
||||
public AriaHTTPException(String tag, String message) {
|
||||
super(tag, String.format("%s\n%s", HTTP_EXCEPTION, message));
|
||||
}
|
||||
|
||||
public AriaLoginException(String tag, String message, Exception e){
|
||||
public AriaHTTPException(String tag, String message, Exception e) {
|
||||
super(tag, message, e);
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
public class AriaIOException extends BaseException{
|
||||
private static final String ARIA_NET_EXCEPTION = "Aria Net Exception:";
|
||||
public class AriaM3U8Exception extends AriaException {
|
||||
private static final String M3U8_EXCEPTION = "Aria M3U8 Exception:";
|
||||
|
||||
public AriaIOException(String tag, String message) {
|
||||
super(tag, String.format("%s%s", ARIA_NET_EXCEPTION, message));
|
||||
public AriaM3U8Exception(String tag, String message) {
|
||||
super(tag, String.format("%s\n%s", M3U8_EXCEPTION, message));
|
||||
}
|
||||
|
||||
public AriaIOException(String tag, String message, Exception e){
|
||||
public AriaM3U8Exception(String tag, String message, Exception e){
|
||||
super(tag, message, e);
|
||||
}
|
||||
}
|
||||
@@ -15,17 +15,14 @@
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
/**
|
||||
* 任务异常
|
||||
*/
|
||||
public class TaskException extends BaseException {
|
||||
private static final String ARIA_TASK_EXCEPTION = "Aria Task Exception:";
|
||||
public class AriaSFTPException extends AriaException {
|
||||
private static final String SFTP_EXCEPTION = "Aria SFTP Exception:";
|
||||
|
||||
public TaskException(String tag, String detailMessage) {
|
||||
super(tag, String.format("%s, %s", ARIA_TASK_EXCEPTION, detailMessage));
|
||||
public AriaSFTPException(String tag, String message) {
|
||||
super(tag, String.format("%s\n%s", SFTP_EXCEPTION, message));
|
||||
}
|
||||
|
||||
public TaskException(String tag, String message, Exception e){
|
||||
public AriaSFTPException(String tag, String message, Exception e) {
|
||||
super(tag, message, e);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
public abstract class BaseException extends Exception {
|
||||
|
||||
private String tag;
|
||||
|
||||
public BaseException(String tag, String message) {
|
||||
super(message);
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public BaseException(String tag, String message, Exception e) {
|
||||
super(String.format("%s\n%s", message == null ? "" : message, e == null ? "" : e.getMessage()));
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
/**
|
||||
* Created by lyy on 2017/1/18.
|
||||
* Aria 文件异常
|
||||
*/
|
||||
public class FileException extends BaseException {
|
||||
private static final String ARIA_FILE_EXCEPTION = "Aria File Exception:";
|
||||
|
||||
public FileException(String tag, String detailMessage) {
|
||||
super(tag, String.format("%s%s", ARIA_FILE_EXCEPTION, detailMessage));
|
||||
}
|
||||
|
||||
public FileException(String tag, String message, Exception e){
|
||||
super(tag, message, e);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
/**
|
||||
* Created by lyy on 2017/1/18.
|
||||
* Aria 文件异常
|
||||
*/
|
||||
public class FileNotFoundException extends BaseException {
|
||||
private static final String ARIA_FILE_EXCEPTION = "Aria File not found Exception:";
|
||||
|
||||
public FileNotFoundException(String tag, String detailMessage) {
|
||||
super(tag, String.format("%s%s", ARIA_FILE_EXCEPTION, detailMessage));
|
||||
}
|
||||
|
||||
public FileNotFoundException(String tag, String message, Exception e) {
|
||||
super(tag, message, e);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.arialyy.aria.exception;
|
||||
|
||||
public class ParamException extends RuntimeException {
|
||||
private static final String ARIA_NET_EXCEPTION = "Aria Params Exception:";
|
||||
|
||||
public ParamException(String message) {
|
||||
super(String.format("%s%s", ARIA_NET_EXCEPTION, message));
|
||||
}
|
||||
}
|
||||
@@ -63,10 +63,8 @@ public class ALog {
|
||||
return println(Log.ERROR, tag, msg);
|
||||
}
|
||||
|
||||
public static int e(String tag, Throwable e) {
|
||||
String msg = getExceptionString(e);
|
||||
ErrorHelp.saveError(tag, "", msg);
|
||||
return println(Log.ERROR, tag, msg);
|
||||
public static void e(String tag, String msg, Throwable e) {
|
||||
Log.e(tag, msg, e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -534,7 +534,7 @@ public class CommonUtil {
|
||||
try {
|
||||
is = new FileInputStream(updateFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
ALog.e(TAG, e);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ public class CommonUtil {
|
||||
try {
|
||||
digest = MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
ALog.e(TAG, e);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ public class CommonUtil {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
ALog.e(TAG, e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user