Skip to content

Commit 72416c6

Browse files
committed
初始化:没有配置时改为不抛异常;优化报错提示语
1 parent 6c0fe8a commit 72416c6

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/main/java/apijson/framework/APIJSONFunctionParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public static <T extends Object> JSONObject init(boolean shutdownWhenServerError
166166
int size = list == null ? 0 : list.size();
167167
if (isAll && size <= 0) {
168168
Log.w(TAG, "init isAll && size <= 0,,没有可用的远程函数");
169-
throw new NullPointerException("没有可用的远程函数");
169+
return response;
170170
}
171171

172172

src/main/java/apijson/framework/APIJSONVerifier.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public static <T> JSONObject initAccess(boolean shutdownWhenServerError, APIJSON
172172
int size = list == null ? 0 : list.size();
173173
if (isAll && size <= 0) {
174174
Log.w(TAG, "initAccess isAll && size <= 0,,没有可用的权限配置");
175-
throw new NullPointerException("没有可用的权限配置");
175+
return response;
176176
}
177177

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

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

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

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

478478

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

482482
if (shutdown) {
483483
System.exit(1);

0 commit comments

Comments
 (0)