From b973f3e8a00968479f3e6a96bfcccee5ff5b7023 Mon Sep 17 00:00:00 2001 From: TommyLemon <1184482681@qq.com> Date: Sun, 29 Jan 2023 12:06:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=9A?= =?UTF-8?q?=E9=A2=84=E9=98=B2=20NPE=EF=BC=8C=E5=87=8F=E5=B0=91=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=89=A7=E8=A1=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/apijson/orm/AbstractObjectParser.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java b/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java index e4cb1ee4..5d8a9db8 100755 --- a/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java +++ b/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java @@ -249,17 +249,19 @@ public AbstractObjectParser parse(String name, boolean isReuse) throws Exception break; } - Object value = entry.getValue(); + String key = entry == null ? null : entry.getKey(); + Object value = key == null ? null : entry.getValue(); if (value == null) { continue; } - String key = entry.getKey(); - + // 处理url crud, 将crud 转换为真实method RequestMethod _method = this.parser.getRealMethod(method, key, value); - // 没有执行校验流程的情况,比如url head, sql@子查询, sql@ method=GET - if (key.endsWith("@") && request.get(key) instanceof JSONObject) { - request.getJSONObject(key).put(apijson.JSONObject.KEY_METHOD, GET); + // 没有执行校验流程的情况,比如url head, sql@子查询, sql@ method=GET + + Object obj = key.endsWith("@") ? request.get(key) : null; + if (obj instanceof JSONObject) { + ((JSONObject) obj).put(apijson.JSONObject.KEY_METHOD, GET); } try {