Skip to content

Commit d31f211

Browse files
committed
Server:解决 AbstractSQLConfig.getWhereItem 可能的 NPE 异常
1 parent c424863 commit d31f211

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

APIJSON-Java-Server/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import static apijson.JSONObject.KEY_JSON;
2727
import static apijson.JSONObject.KEY_ORDER;
2828
import static apijson.JSONObject.KEY_ROLE;
29+
import static apijson.JSONObject.KEY_RAW;
2930
import static apijson.JSONObject.KEY_SCHEMA;
3031
import static apijson.JSONObject.KEY_USER_ID;
3132
import static apijson.RequestMethod.DELETE;
@@ -1446,10 +1447,8 @@ private String getWhereItem(String key, Object value
14461447
, RequestMethod method, boolean verifyName) throws Exception {
14471448
Log.d(TAG, "getWhereItem key = " + key);
14481449
//避免筛选到全部 value = key == null ? null : where.get(key);
1449-
if(key.equals("@raw")){
1450-
Log.d(TAG, "getWhereItem key startsWith @ = @raw ");
1451-
// 自定义where条件拼接,直接通过,放行
1452-
}else if (key == null || value == null || key.startsWith("@") || key.endsWith("()")) {//关键字||方法, +或-直接报错
1450+
if (key == null || value == null || key.endsWith("()")
1451+
|| (key.startsWith("@") && KEY_RAW.equals(key) == false)) { //关键字||方法, +或-直接报错
14531452
Log.d(TAG, "getWhereItem key == null || value == null"
14541453
+ " || key.startsWith(@) || key.endsWith(()) >> continue;");
14551454
return null;

0 commit comments

Comments
 (0)