Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与验收标准
RequestKitBean#reqParam2JSON()仅凭参数名是否包含[就按主键[子键]语法解析,随后用name.indexOf("]")作为substring的结束下标(jeepay-core/src/main/java/com/jeequan/jeepay/core/beans/RequestKitBean.java:128-129)。当参数名含[但没有](例如?ps[abc=1),或]出现在[之前(例如?a]b[=2)时,indexOf("]")返回 -1 或小于起始下标,substring抛StringIndexOutOfBoundsException,整个请求以 500 失败。预期:括号不配对的名称按普通键原样保留,不影响其他参数的解析。该方法是getReqParamJSON()(同文件 143-150 行)的唯一取值入口,被AbstractCtrl#getReqParamJSON()及全部控制器的分页、排序、金额等取值复用。String[]多值拼接分支、不改 JSON 请求体分支。改动与兼容性
!name.contains("[")改为!name.contains("[") || name.indexOf("]") < name.indexOf("["),只有形如xxx[yyy]的名称才进入对象属性解析。验证
mvn -o -pl jeepay-core -Dtest=RequestKitBeanMalformedParamTest test→Tests run: 2, Failures: 2,两条均为AssertionFailedError: Unexpected exception thrown: java.lang.StringIndexOutOfBoundsException: Range [3, -1) out of bounds for length 6/Range [4, 1) out of bounds for length 4。mvn -o -pl jeepay-core -Dtest='RequestKitBeanMalformedParamTest,FastJsonCompatSmokeTest,LogSanitizerTest' test→Tests run: 12, Failures: 0, Errors: 0, Skipped: 0。RequestKitBeanMalformedParamTest用HttpServletRequest动态代理构造非 JSON 请求,分别覆盖ps[abc(缺])与a]b[(]在[之前)两种参数名,断言解析不抛异常且键值被保留。修复前两条断言失败,修复后通过。合并前核对
dev;稳定热修复到master并关联回同步dev的计划 / PRPrepared with an AI coding agent.