YvCeung commented on code in PR #7904:
URL: https://github.com/apache/incubator-seata/pull/7904#discussion_r2648881949


##########
namingserver/src/main/java/org/apache/seata/namingserver/manager/NamingManager.java:
##########
@@ -219,11 +219,10 @@ public Result<String> createGroup(
             Map<String, String> header = new HashMap<>();
             header.put(HTTP.CONTENT_TYPE, 
ContentType.APPLICATION_FORM_URLENCODED.getMimeType());
 
-            try (CloseableHttpResponse closeableHttpResponse = 
HttpClientUtil.doGet(httpUrl, params, header, 3000)) {
-                if (closeableHttpResponse == null
-                        || 
closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
+            try (Response httpResponse = HttpClientUtil.doGet(httpUrl, params, 
header, 3000)) {
+                if (httpResponse == null || httpResponse.code() != 200) {
                     return new Result<>(
-                            
String.valueOf(closeableHttpResponse.getStatusLine().getStatusCode()),
+                            String.valueOf(httpResponse != null ? 
httpResponse.code() : 500),
                             "add vGroup in new cluster failed");
                 }

Review Comment:
   The current logic only checks the HTTP status code and does not depend on 
the response body.
   Response.code() is always available regardless of whether the body is null.
   Therefore, checking the response body first is not required in this context.



-- 
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