You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/06/20 12:29:30 UTC

[GitHub] [inlong] kipshi opened a new pull request, #4712: [INLONG][Manager] Fix json parse failed in Manager Client

kipshi opened a new pull request, #4712:
URL: https://github.com/apache/inlong/pull/4712

   ### Prepare a Pull Request
   *(Change the title refer to the following example)*
   
   - Title Example: [INLONG-XYZ][Component] Title of the pull request
   
   *(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/incubator-inlong/issues) number)*
   
   - Fixes #4711 
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve?*
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] This change is a trivial rework/code cleanup without any test coverage.
   
   - [ ] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] This change added tests and can be verified as follows:
   
     *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
   


-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4712:
URL: https://github.com/apache/inlong/pull/4712#discussion_r902690385


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/InnerInlongManagerClient.java:
##########
@@ -144,12 +149,21 @@ public Boolean isGroupExists(String inlongGroupId) {
     /**
      * Get information of group.
      */
+    @SneakyThrows
     public InlongGroupInfo getGroupInfo(String inlongGroupId) {
         AssertUtils.notEmpty(inlongGroupId, "InlongGroupId should not be empty");
 
-        Response<InlongGroupInfo> responseBody = executeHttpCall(inlongGroupApi.getGroupInfo(inlongGroupId));
+        Response<Object> responseBody = executeHttpCall(inlongGroupApi.getGroupInfo(inlongGroupId));
         if (responseBody.isSuccess()) {
-            return responseBody.getData();
+            JSONObject groupInfoJson = JsonUtils.parseObject(
+                    JsonUtils.toJsonString(JsonUtils.toJsonString(responseBody.getData())),

Review Comment:
   See this:
   
   <img width="1472" alt="2be5da2d56a97360df8d0608dc430e50" src="https://user-images.githubusercontent.com/31994335/174823812-5c764c72-544a-4fbb-932a-746d6fb71f32.png">
   



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] kipshi commented on a diff in pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
kipshi commented on code in PR #4712:
URL: https://github.com/apache/inlong/pull/4712#discussion_r902514591


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/impl/InlongGroupImpl.java:
##########
@@ -102,8 +107,19 @@ public InlongGroupContext init() throws Exception {
                         processView.getStatus()));
 
         // init must be NewGroupProcessForm
+        // compile with old cluster
+        JSONObject formDataJson =
+                JsonUtils.parseObject(JsonUtils.toJsonString(JsonUtils.toJsonString(processView.getFormData())),

Review Comment:
   same as above



##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/InnerInlongManagerClient.java:
##########
@@ -144,12 +149,21 @@ public Boolean isGroupExists(String inlongGroupId) {
     /**
      * Get information of group.
      */
+    @SneakyThrows
     public InlongGroupInfo getGroupInfo(String inlongGroupId) {
         AssertUtils.notEmpty(inlongGroupId, "InlongGroupId should not be empty");
 
-        Response<InlongGroupInfo> responseBody = executeHttpCall(inlongGroupApi.getGroupInfo(inlongGroupId));
+        Response<Object> responseBody = executeHttpCall(inlongGroupApi.getGroupInfo(inlongGroupId));
         if (responseBody.isSuccess()) {
-            return responseBody.getData();
+            JSONObject groupInfoJson = JsonUtils.parseObject(
+                    JsonUtils.toJsonString(JsonUtils.toJsonString(responseBody.getData())),

Review Comment:
   body is hashMap
   first ( toJsonString ) make it string
   second( toJsonString ) make it json_string



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] kipshi commented on a diff in pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
kipshi commented on code in PR #4712:
URL: https://github.com/apache/inlong/pull/4712#discussion_r902110035


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/util/JsonUtils.java:
##########
@@ -50,6 +51,7 @@ public class JsonUtils {
 
     static {
         OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+        OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Review Comment:
   Very reasonable



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] healchow merged pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
healchow merged PR #4712:
URL: https://github.com/apache/inlong/pull/4712


-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] leosanqing commented on a diff in pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
leosanqing commented on code in PR #4712:
URL: https://github.com/apache/inlong/pull/4712#discussion_r901795252


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/util/JsonUtils.java:
##########
@@ -50,6 +51,7 @@ public class JsonUtils {
 
     static {
         OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+        OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Review Comment:
   Should this attribute be added with caution? If so, after we modify the attribute name, the statement that should have parsed the error will not be reported, and cause invisible bugs
   
   I think this should be placed on the corresponding class, no global settings are required



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] leosanqing commented on a diff in pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
leosanqing commented on code in PR #4712:
URL: https://github.com/apache/inlong/pull/4712#discussion_r902419300


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/impl/InlongGroupImpl.java:
##########
@@ -102,8 +107,19 @@ public InlongGroupContext init() throws Exception {
                         processView.getStatus()));
 
         // init must be NewGroupProcessForm
+        // compile with old cluster
+        JSONObject formDataJson =
+                JsonUtils.parseObject(JsonUtils.toJsonString(JsonUtils.toJsonString(processView.getFormData())),

Review Comment:
   Why call toJsonString 2 times here?



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] dockerzhang commented on pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
dockerzhang commented on PR #4712:
URL: https://github.com/apache/inlong/pull/4712#issuecomment-1160441592

   @kipshi UT failed, please check again.


-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] kipshi commented on a diff in pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
kipshi commented on code in PR #4712:
URL: https://github.com/apache/inlong/pull/4712#discussion_r902335926


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/util/JsonUtils.java:
##########
@@ -50,6 +51,7 @@ public class JsonUtils {
 
     static {
         OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+        OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Review Comment:
   our api is changed quite frequently, some fields is addes and some fields is gone, in order to keep forward compatibility , this config is needed



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #4712: [INLONG-4711][Manager] Fix JSON parse failed in client

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4712:
URL: https://github.com/apache/inlong/pull/4712#discussion_r902359778


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/inner/InnerInlongManagerClient.java:
##########
@@ -144,12 +149,21 @@ public Boolean isGroupExists(String inlongGroupId) {
     /**
      * Get information of group.
      */
+    @SneakyThrows
     public InlongGroupInfo getGroupInfo(String inlongGroupId) {
         AssertUtils.notEmpty(inlongGroupId, "InlongGroupId should not be empty");
 
-        Response<InlongGroupInfo> responseBody = executeHttpCall(inlongGroupApi.getGroupInfo(inlongGroupId));
+        Response<Object> responseBody = executeHttpCall(inlongGroupApi.getGroupInfo(inlongGroupId));
         if (responseBody.isSuccess()) {
-            return responseBody.getData();
+            JSONObject groupInfoJson = JsonUtils.parseObject(
+                    JsonUtils.toJsonString(JsonUtils.toJsonString(responseBody.getData())),

Review Comment:
   Why call `toJsonString` 2 times here?



-- 
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: commits-unsubscribe@inlong.apache.org

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