Skip to content

Commit

Permalink
初始化:没有配置时改为不抛异常;优化报错提示语
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLemon committed May 3, 2022
1 parent 6c0fe8a commit 72416c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/apijson/framework/APIJSONFunctionParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static <T extends Object> JSONObject init(boolean shutdownWhenServerError
int size = list == null ? 0 : list.size();
if (isAll && size <= 0) {
Log.w(TAG, "init isAll && size <= 0,,没有可用的远程函数");
throw new NullPointerException("没有可用的远程函数");
return response;
}


Expand Down
12 changes: 6 additions & 6 deletions src/main/java/apijson/framework/APIJSONVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static <T> JSONObject initAccess(boolean shutdownWhenServerError, APIJSON
int size = list == null ? 0 : list.size();
if (isAll && size <= 0) {
Log.w(TAG, "initAccess isAll && size <= 0,,没有可用的权限配置");
throw new NullPointerException("没有可用的权限配置");
return response;
}

Log.d(TAG, "initAccess < for ACCESS_MAP.size() = " + ACCESS_MAP.size() + " <<<<<<<<<<<<<<<<<<<<<<<<");
Expand Down Expand Up @@ -302,15 +302,15 @@ public static <T> JSONObject initRequest(boolean shutdownWhenServerError, APIJSO

JSONObject response = creator.createParser().setMethod(RequestMethod.GET).setNeedVerify(false).parseResponse(request);
if (JSONResponse.isSuccess(response) == false) {
Log.e(TAG, "\n\n\n\n\n !!!! 查询权限配置异常 !!!\n" + response.getString(JSONResponse.KEY_MSG) + "\n\n\n\n\n");
onServerError("查询权限配置异常 !", shutdownWhenServerError);
Log.e(TAG, "\n\n\n\n\n !!!! 查询请求校验规则配置异常 !!!\n" + response.getString(JSONResponse.KEY_MSG) + "\n\n\n\n\n");
onServerError("查询请求校验规则配置异常 !", shutdownWhenServerError);
}

JSONArray list = response.getJSONArray(REQUEST_ + "[]");
int size = list == null ? 0 : list.size();
if (isAll && size <= 0) {
Log.w(TAG, "initRequest isAll && size <= 0,没有可用的权限配置");
throw new NullPointerException("没有可用的权限配置");
Log.w(TAG, "initRequest isAll && size <= 0,没有可用的请求校验规则配置");
return response;
}

Log.d(TAG, "initRequest < for REQUEST_MAP.size() = " + REQUEST_MAP.size() + " <<<<<<<<<<<<<<<<<<<<<<<<");
Expand Down Expand Up @@ -477,7 +477,7 @@ public static void testStructure() throws Exception {


protected static void onServerError(String msg, boolean shutdown) throws ServerException {
Log.e(TAG, "\n权限配置文档测试未通过\n请修改 Access 表里的记录!\n保证前端看到的权限配置文档是正确的!!!\n\n原因:\n" + msg);
Log.e(TAG, "\n校验配置测试未通过\n请修改 Access/Request 表里的记录!\n保证所有配置都是正确的!!!\n\n原因:\n" + msg);

if (shutdown) {
System.exit(1);
Expand Down

0 comments on commit 72416c6

Please sign in to comment.