Skip to content

Commit 2d01a5a

Browse files
committed
Server:优化getMaxQueryDepth的判断
1 parent a39878c commit 2d01a5a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

APIJSON-Java-Server/APIJSONORM/src/main/java/zuo/biao/apijson/server/AbstractParser.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,16 +636,17 @@ public JSONObject onObjectParse(final JSONObject request
636636
return null;
637637
}
638638

639+
int type = arrayConfig == null ? 0 : arrayConfig.getType();
640+
641+
String[] arr = StringUtil.split(parentPath, "/");
639642
if (arrayConfig == null || arrayConfig.getPosition() == 0) {
643+
queryDepth = arr == null ? 0 : arr.length;
640644
int maxQueryDepth = getMaxQueryDepth();
641645
if (queryDepth > maxQueryDepth) {
642646
throw new IllegalArgumentException(parentPath + "/" + name + ":{} 的深度(或者说层级) 为 " + queryDepth + " 已超限,必须在 0-" + maxQueryDepth + " 内 !");
643647
}
644-
queryDepth ++;
645648
}
646649

647-
int type = arrayConfig == null ? 0 : arrayConfig.getType();
648-
649650
ObjectParser op = createObjectParser(request, parentPath, name, arrayConfig, isSubquery).parse();
650651

651652

0 commit comments

Comments
 (0)