Jackson解析Enum类型出现异常,未使用InvocationException进行捕获处理
用户提交的请求参数中Enum值不在swagger的yaml约束的范围内,例如swagger的yaml约束operation为“1”或“2”,输入“operation”:“”或“operation”:“3”,EnumDeserializerl类中使用Jackson解析均会均会抛出JsonMappingException异常,但是RestCodec的restToArgs方法未捕获JsonMappingException,只是使用了Exception来捕获异常但并未获取异常的字段,导致使用spi 机制实现ProduceJsonProcessor时,无法获取框架解析异常的字段,我们需要在RestCodec中捕获json异常,以便于使用ProduceJsonProcessor接收并处理,并向用户展示请求参数中导致异常的字段;建议RestCodec.restToArgs()中使用JsonMappingException.getPath().get(i).getFieldName()接收多个path,并使用throw new InvocationException(Status.BAD_REQUEST, ErrorCode.PARAM_INVALID, stb.toString());把异常抛给ProduceJsonProcessor处理 (或使用InvalidFormatException,但是由于主要是枚举类解析会出现异常,所以也可使用JsonMappingException处理)
This issue has the same title and description as #3696. Please continue the discussion there so that follow-up is tracked in one place. We are closing this issue as a duplicate; this does not mean the defect has been fixed. If this involves a different version or an independent reproduction scenario, please describe the differences so that this issue can be reopened for tracking.