Copilot commented on code in PR #7430:
URL: https://github.com/apache/incubator-seata/pull/7430#discussion_r2141486598


##########
core/src/main/java/org/apache/seata/core/rpc/netty/http/ParameterParser.java:
##########
@@ -89,14 +98,36 @@ private static Object[] getParameters(Class<?>[] 
parameterTypes, ParamMetaData[]
     private static Object getArgValue(Class<?> parameterType, String 
parameterName, ParamMetaData paramMetaData,
         ObjectNode paramMap, HttpContext httpContext) {
         ParamMetaData.ParamConvertType paramConvertType = 
paramMetaData.getParamConvertType();
-        if (parameterType.equals(HttpContext.class)) {
+        if (parameterType == null || parameterType.equals(HttpContext.class)) {

Review Comment:
   [nitpick] The null check on `parameterType` is unnecessary since reflection 
APIs never produce a null parameter type. You can simplify this to check only 
for `HttpContext.class`.
   ```suggestion
           if (parameterType.equals(HttpContext.class)) {
   ```



##########
core/src/main/java/org/apache/seata/core/rpc/netty/http/ParameterParser.java:
##########
@@ -26,19 +26,28 @@
 import java.lang.reflect.Parameter;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
+
 import org.apache.seata.common.rpc.http.HttpContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import static 
com.fasterxml.jackson.databind.SerializationFeature.FAIL_ON_EMPTY_BEANS;
 
+/**
+ * A utility class for parsing HTTP request parameters and converting them 
into Java objects.
+ * Supports various parameter types including request params, request body, 
model attributes, etc.
+ */
 public class ParameterParser {
 
     private static final Logger LOGGER = 
LoggerFactory.getLogger(ParameterParser.class);
 
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
         .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, 
false).configure(FAIL_ON_EMPTY_BEANS, false);
 
+    private static final String DEFAULT_NONE = 
"\n\t\t\n\t\t\n\ue000\ue001\ue002\n\t\t\t\t\n";

Review Comment:
   This sentinel value duplicates `ValueConstants.DEFAULT_NONE`. Consider 
reusing the Spring constant (`ValueConstants.DEFAULT_NONE`) here to avoid 
divergence if it changes.



-- 
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: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to