Fix issue 3050 属性Feature.InitStringFieldAsEmpty导致没有使用双引号的数值型value解析错误 #3142
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.
fixed #3050
解析json时如果设置属性 Feature.InitStringFieldAsEmpty,ASMDeserializerFactory 生成的字节码会将String类型的字段值设为空字符串并标记该字段的flag为 parse(相当于默认所有String类型的flag为parse)。
如果此时解析如下json串:
由于name对应的bean字段是String类型,但name的value没有使用双引号,导致当执行 scanFieldString 方法时取不到name的值,而后续的 smartMatch 方法由于String类型字段的flag已被设置为parse,会导致找不到对应的 fieldDeserializer,从而导致解析结果错误。