From a398285c91d15ead2b4e9cceebea91e58c2efc90 Mon Sep 17 00:00:00 2001 From: Zhenjie Yan Date: Fri, 5 Feb 2021 16:27:11 +0800 Subject: [PATCH] Release v2.1.7. --- README.md | 6 +++--- build.gradle | 2 +- gradle.properties | 2 +- .../java/com/yanzhenjie/andserver/sample/CoreService.java | 1 + .../andserver/sample/component/AppExceptionResolver.java | 6 +++--- .../andserver/sample/component/LoginInterceptor.java | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 660acfe..38077c0 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ buildscript { } dependencies { - classpath 'com.yanzhenjie.andserver:plugin:2.1.6' + classpath 'com.yanzhenjie.andserver:plugin:2.1.7' ... } } @@ -125,8 +125,8 @@ apply plugin: 'com.yanzhenjie.andserver' ... dependencies { - implementation 'com.yanzhenjie.andserver:api:2.1.6' - annotationProcessor 'com.yanzhenjie.andserver:processor:2.1.6' + implementation 'com.yanzhenjie.andserver:api:2.1.7' + annotationProcessor 'com.yanzhenjie.andserver:processor:2.1.7' ... } ``` diff --git a/build.gradle b/build.gradle index 2db53c6..1bc7ea2 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { classpath 'com.android.tools.build:gradle:3.6.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5' - classpath "com.yanzhenjie.andserver:plugin:2.1.5" + classpath "com.yanzhenjie.andserver:plugin:2.1.7" } } diff --git a/gradle.properties b/gradle.properties index 5d1fcc5..9f08f6b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ android.useAndroidX=true PROJECT_GROUP=com.yanzhenjie.andserver -PROJECT_VERSION=2.1.6 +PROJECT_VERSION=2.1.7 POM_DESCRIPTION=Android web server. diff --git a/sample/src/main/java/com/yanzhenjie/andserver/sample/CoreService.java b/sample/src/main/java/com/yanzhenjie/andserver/sample/CoreService.java index 172a464..983242d 100644 --- a/sample/src/main/java/com/yanzhenjie/andserver/sample/CoreService.java +++ b/sample/src/main/java/com/yanzhenjie/andserver/sample/CoreService.java @@ -54,6 +54,7 @@ public void onStopped() { @Override public void onException(Exception e) { + e.printStackTrace(); ServerManager.onServerError(CoreService.this, e.getMessage()); } }) diff --git a/sample/src/main/java/com/yanzhenjie/andserver/sample/component/AppExceptionResolver.java b/sample/src/main/java/com/yanzhenjie/andserver/sample/component/AppExceptionResolver.java index e23025f..53b54f7 100644 --- a/sample/src/main/java/com/yanzhenjie/andserver/sample/component/AppExceptionResolver.java +++ b/sample/src/main/java/com/yanzhenjie/andserver/sample/component/AppExceptionResolver.java @@ -18,7 +18,7 @@ import androidx.annotation.NonNull; import com.yanzhenjie.andserver.annotation.Resolver; -import com.yanzhenjie.andserver.error.BasicException; +import com.yanzhenjie.andserver.error.HttpException; import com.yanzhenjie.andserver.framework.ExceptionResolver; import com.yanzhenjie.andserver.framework.body.JsonBody; import com.yanzhenjie.andserver.http.HttpRequest; @@ -35,8 +35,8 @@ public class AppExceptionResolver implements ExceptionResolver { @Override public void onResolve(@NonNull HttpRequest request, @NonNull HttpResponse response, @NonNull Throwable e) { e.printStackTrace(); - if (e instanceof BasicException) { - BasicException exception = (BasicException) e; + if (e instanceof HttpException) { + HttpException exception = (HttpException) e; response.setStatus(exception.getStatusCode()); } else { response.setStatus(StatusCode.SC_INTERNAL_SERVER_ERROR); diff --git a/sample/src/main/java/com/yanzhenjie/andserver/sample/component/LoginInterceptor.java b/sample/src/main/java/com/yanzhenjie/andserver/sample/component/LoginInterceptor.java index bfc767b..0eb9447 100644 --- a/sample/src/main/java/com/yanzhenjie/andserver/sample/component/LoginInterceptor.java +++ b/sample/src/main/java/com/yanzhenjie/andserver/sample/component/LoginInterceptor.java @@ -18,7 +18,7 @@ import androidx.annotation.NonNull; import com.yanzhenjie.andserver.annotation.Interceptor; -import com.yanzhenjie.andserver.error.BasicException; +import com.yanzhenjie.andserver.error.HttpException; import com.yanzhenjie.andserver.framework.HandlerInterceptor; import com.yanzhenjie.andserver.framework.handler.MethodHandler; import com.yanzhenjie.andserver.framework.handler.RequestHandler; @@ -44,7 +44,7 @@ public boolean onIntercept(@NonNull HttpRequest request, @NonNull HttpResponse r MethodHandler methodHandler = (MethodHandler) handler; Addition addition = methodHandler.getAddition(); if (!isLogin(request, addition)) { - throw new BasicException(401, "You are not logged in yet."); + throw new HttpException(401, "You are not logged in yet."); } } return false;