funky-eyes opened a new issue, #14696:
URL: https://github.com/apache/dubbo/issues/14696

   ### Pre-check
   
   - [X] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   dubbo 3.2.16
   
   
   ### Steps to reproduce this issue
   
   ```
       @POST
       @Path("/test")
       public ResponseVO test(
           @FormParam("path") @QueryParam("path")  String 
path,@FormParam("body") @QueryParam("body")  String body) {
   ......
   }
   ```
   
   ```
   POST http://localhost:8087/test
   Content-Type: application/x-www-form-urlencoded
   
   body=a&
   path=a
   ```
   After the request, both path and body are null, because the following 
arraylist always reads only the 0th argument.
   ```
       public Object decode(byte[] body, Class<?> targetType, Type type) throws 
Exception {
           Object map = DataParseUtils.multipartFormConvert(body, targetType);
           Map valuesMap = (Map) map;
           if (Map.class.isAssignableFrom(targetType)) {
               return map;
           } else if (DataParseUtils.isTextType(targetType)) {
   
               // only fetch  first
               Set set = valuesMap.keySet();
               ArrayList arrayList = new ArrayList<>(set);
               Object key = arrayList.get(0);
               Object value = valuesMap.get(key);
               if (value == null) {
                   return null;
               }
               return DataParseUtils.stringTypeConvert(targetType, 
String.valueOf(((List) value).get(0)));
   
           }
   ....
   }
   ```
   
然后ParamProviderParamParser在解析为null时,会set下标为null,而在它之前的BodyProviderParamParser已经将值解析后进行set,却被前者给覆盖为null
   Then, when ParamProviderParamParser parses to null, it sets the index to 
null, while the previous BodyProviderParamParser has already parsed and set the 
value, which gets overridden to null by the former
   
   ### What you expected to happen
   
   
如果其中一个parser解析出null值,不应该进行set,然后应该将ArgInfo向下传入,而不是传入type,type中没有paramName,所以在BodyProviderParamParser中无法找到对应的Param
   If one of the parsers parses a null value, it should not perform the set 
action, and the ArgInfo should be passed into the parser instead of just the 
type. The type does not contain the paramName, so the corresponding parameter 
cannot be found in BodyProviderParamParser
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [X] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to