YvCeung opened a new issue, #7732: URL: https://github.com/apache/incubator-seata/issues/7732
### Check Ahead - [x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate. - [x] I am willing to try to fix this bug myself. ### Ⅰ. Issue Description When making HTTP/2 POST requests with Content-Type: `application/x-www-form-urlencoded`, the Http2HttpHandler.handleRequest() method incorrectly assumes all request bodies are JSON format, leading to parsing failures and potential NPE exceptions. <img width="1750" height="1225" alt="Image" src="https://github.com/user-attachments/assets/6a0fb3d5-47f7-4a45-8c75-c1dab6c2d8b9" /> 14:38:19.572 WARN --- [ttyServerNIOWorker_1_1_32] [pc.netty.http.Http2HttpHandler] [ handleRequest] [] : Failed to parse http2 body as json: Unrecognized token 'default': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (String)"default-test=1"; line: 1, column: 8] 14:38:19.595 ERROR --- [HTTPHandlerThread_1_1_100] [pc.netty.http.Http2HttpHandler] [ lambda$handle$1] [] : Exception occurred while processing HTTP2 request: null ==> java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.seata.core.rpc.netty.http.Http2HttpHandler.lambda$handle$1(Http2HttpHandler.java:152) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.NullPointerException: null at org.apache.seata.server.controller.ClusterController.watch(ClusterController.java:120) ... 9 common frames omitted <== Exception in thread "OkHttp Dispatcher" org.opentest4j.AssertionFailedError: expected: <304> but was: <500> at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55) at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:527) at org.apache.seata.server.controller.ClusterControllerTest$1.onSuccess(ClusterControllerTest.java:101) at org.apache.seata.server.controller.ClusterControllerTest$1.onSuccess(ClusterControllerTest.java:96) at org.apache.seata.common.util.HttpClientUtil$1.onResponse(HttpClientUtil.java:310) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) 14:38:29.373 INFO --- [ main] [ta.config.ConfigurationFactory] [ load] [] : load Configuration from :FileConfiguration$$EnhancerByCGLIB$$6e15d955 org.opentest4j.AssertionFailedError: Expected :true Actual :false <Click to see difference> ### Ⅱ. Describe what happened _No response_ ### Ⅲ. Describe what you expected to happen HTTP/2 requests with application/x-www-form-urlencoded content type should be parsed correctly, similar to how HTTP/1.1 requests are handled. Actual behavior: HTTP/1.1 requests with application/x-www-form-urlencoded work correctly HTTP/2 requests with application/x-www-form-urlencoded fail with NPE during request body parsing The handler attempts to parse form data as JSON, which fails and causes downstream issues ### Ⅳ. How to reproduce it (as minimally and precisely as possible) _No response_ ### Ⅴ. Anything else we need to know? _No response_ ### Ⅵ. Environment _No response_ -- 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]
