You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "mxsm (via GitHub)" <gi...@apache.org> on 2023/02/11 13:28:28 UTC

[GitHub] [incubator-eventmesh] mxsm opened a new pull request, #3123: [ISSUE #3122]Refactor JsonUtils

mxsm opened a new pull request, #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123

   <!--
   ### Contribution Checklist
   
     - Name the pull request in the form "[ISSUE #XXXX] Title of the pull request", 
       where *XXXX* should be replaced by the actual issue number.
       Skip *[ISSUE #XXXX]* if there is no associated github issue for this pull request.
   
     - Fill out the template below to describe the changes contributed by the pull request. 
       That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue. 
       Please do not mix up code from multiple issues.
     
     - Each commit in the pull request should have a meaningful commit message.
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, 
       leaving only the filled out template below.
   
   (The sections below can be removed for hotfixes of typos)
   -->
   
   <!--
   (If this PR fixes a GitHub issue, please add `Fixes #<XXX>` or `Cloese #<XXX>`.)
   -->
   
   Fixes #3122 
   
   ### Motivation
   
   *Explain the content here.*
   *Explain why you want to make the changes and what problem you're trying to solve.*
   
   
   
   ### Modifications
   
   1. Consolidate the JsonUtils utility class in the project by merging the JsonUtils utility classes in the runtime module and the Common module.
   2. Remove the JsonUtils utility class in the runtime module.
   3. Add test cases for JsonUtils.
   
   
   
   ### 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 followup 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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx commented on PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#issuecomment-1426967012

   @mxsm pls fix build error.


-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103735338


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -62,72 +63,72 @@ public static String serialize(Object obj) {
         }
     }
 
-    public static <T> byte[] serialize(String topic, Class<T> data) throws JsonProcessingException {
-        if (Objects.isNull(data)) {
+    public static byte[] toBytes(Object obj) {

Review Comment:
   @jonyangx  I will fix it and resubmit later



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103784577


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -62,72 +63,72 @@ public static String serialize(Object obj) {
         }
     }
 
-    public static <T> byte[] serialize(String topic, Class<T> data) throws JsonProcessingException {
-        if (Objects.isNull(data)) {
+    public static byte[] toJSONBytes(Object obj) {
+        if (Objects.isNull(obj)) {
             return null;
         }
         try {
-            return OBJECT_MAPPER.writeValueAsBytes(data);
+            return OBJECT_MAPPER.writeValueAsBytes(obj);
         } catch (JsonProcessingException e) {
             throw new JsonException("serialize to json error", e);
         }
     }
 
     /**
-     * Deserialize json string to object.
+     * parse json string to object.
      *
-     * @param json json string
-     * @param clz  object class
-     * @param <T>  object type
+     * @param text  json string
+     * @param clazz object class
+     * @param <T>   object type
      * @return object
      */
-    public static <T> T deserialize(String json, Class<T> clz) {
-        if (StringUtils.isEmpty(json)) {
+    public static <T> T parseObject(String text, Class<T> clazz) {

Review Comment:
   @mxsm I think toObject() is better.



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103786821


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -39,10 +41,9 @@ public class JsonUtils {
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     static {
-        OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
-            .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
         OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
-
+        OBJECT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        OBJECT_MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

Review Comment:
   In eventmesh project should define default date format pattern in jsonutil. @mxsm 
   eg. objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
         objectMapper.setDateFormat(new CustomDateFormat("yyyy-MM-dd HH:mm:ss"))
   



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx merged pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx merged PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123


-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103734744


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -62,72 +63,72 @@ public static String serialize(Object obj) {
         }
     }
 
-    public static <T> byte[] serialize(String topic, Class<T> data) throws JsonProcessingException {
-        if (Objects.isNull(data)) {
+    public static byte[] toBytes(Object obj) {
+        if (Objects.isNull(obj)) {
             return null;
         }
         try {
-            return OBJECT_MAPPER.writeValueAsBytes(data);
+            return OBJECT_MAPPER.writeValueAsBytes(obj);
         } catch (JsonProcessingException e) {
             throw new JsonException("serialize to json error", e);
         }
     }
 
     /**
-     * Deserialize json string to object.
+     * parse json string to object.
      *
-     * @param json json string
-     * @param clz  object class
-     * @param <T>  object type
+     * @param text  json string
+     * @param clazz object class
+     * @param <T>   object type
      * @return object
      */
-    public static <T> T deserialize(String json, Class<T> clz) {
-        if (StringUtils.isEmpty(json)) {
+    public static <T> T parseObject(String text, Class<T> clazz) {
+        if (StringUtils.isEmpty(text)) {
             return null;
         }
         try {
-            return OBJECT_MAPPER.readValue(json, clz);
+            return OBJECT_MAPPER.readValue(text, clazz);
         } catch (JsonProcessingException e) {
             throw new JsonException("deserialize json string to object error", e);
         }
     }
 
-    public static <T> T deserialize(Class<T> clazz, byte[] bytes) {
+    public static <T> T parseObject(byte[] bytes, Class<T> clazz) {
         if (bytes == null || bytes.length == 0) {
             return null;
         }
         try {
             return OBJECT_MAPPER.readValue(bytes, clazz);
         } catch (IOException e) {
-            throw new JsonException(String.format("deserialize bytes to %s error", clazz), e);
+            throw new JsonException(String.format("parse bytes to %s error", clazz), e);
         }
     }
 
     /**
-     * Deserialize json string to object.
+     * parse json string to object.
      *
-     * @param str           json string
+     * @param text          json string
      * @param typeReference object type reference
      * @param <T>           object type
      * @return object
      */
-    public static <T> T deserialize(String str, TypeReference<T> typeReference) {
-        if (StringUtils.isEmpty(str)) {
+    public static <T> T parseObject(String text, TypeReference<T> typeReference) {

Review Comment:
   Method name is inaccurate.Jackson api is readValue().



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103734294


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -62,72 +63,72 @@ public static String serialize(Object obj) {
         }
     }
 
-    public static <T> byte[] serialize(String topic, Class<T> data) throws JsonProcessingException {
-        if (Objects.isNull(data)) {
+    public static byte[] toBytes(Object obj) {

Review Comment:
   Suggest use toJsonBytes is better.



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] codecov[bot] commented on pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#issuecomment-1426778842

   # [Codecov](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3123](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0059bde) into [master](https://codecov.io/gh/apache/incubator-eventmesh/commit/0eda1e5e3014f9b32530eaab4a45aac3c9e81f9d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0eda1e5) will **decrease** coverage by `0.02%`.
   > The diff coverage is `9.49%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3123      +/-   ##
   ============================================
   - Coverage     12.95%   12.94%   -0.02%     
   - Complexity     1110     1111       +1     
   ============================================
     Files           548      547       -1     
     Lines         28658    28630      -28     
     Branches       2866     2854      -12     
   ============================================
   - Hits           3714     3705       -9     
   + Misses        24624    24603      -21     
   - Partials        320      322       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...entmesh/common/protocol/http/HttpEventWrapper.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL0h0dHBFdmVudFdyYXBwZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...rotocol/http/body/client/HeartbeatRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvY2xpZW50L0hlYXJ0YmVhdFJlcXVlc3RCb2R5LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...mmon/protocol/http/body/client/RegRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvY2xpZW50L1JlZ1JlcXVlc3RCb2R5LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...rotocol/http/body/client/SubscribeRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvY2xpZW50L1N1YnNjcmliZVJlcXVlc3RCb2R5LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...on/protocol/http/body/client/UnRegRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvY2xpZW50L1VuUmVnUmVxdWVzdEJvZHkuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...tocol/http/body/client/UnSubscribeRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvY2xpZW50L1VuU3Vic2NyaWJlUmVxdWVzdEJvZHkuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ocol/http/body/message/PushMessageRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvbWVzc2FnZS9QdXNoTWVzc2FnZVJlcXVlc3RCb2R5LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...col/http/body/message/ReplyMessageRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvbWVzc2FnZS9SZXBseU1lc3NhZ2VSZXF1ZXN0Qm9keS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...http/body/message/SendMessageBatchRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvbWVzc2FnZS9TZW5kTWVzc2FnZUJhdGNoUmVxdWVzdEJvZHkuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ocol/http/body/message/SendMessageRequestBody.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi9wcm90b2NvbC9odHRwL2JvZHkvbWVzc2FnZS9TZW5kTWVzc2FnZVJlcXVlc3RCb2R5LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | ... and [65 more](https://codecov.io/gh/apache/incubator-eventmesh/pull/3123?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103786821


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -39,10 +41,9 @@ public class JsonUtils {
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     static {
-        OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
-            .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
         OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
-
+        OBJECT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        OBJECT_MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

Review Comment:
   In eventmesh project should define default date format pattern in jsonutil. @mxsm 
   eg. objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"))



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103786821


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -39,10 +41,9 @@ public class JsonUtils {
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     static {
-        OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
-            .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
         OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
-
+        OBJECT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        OBJECT_MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

Review Comment:
   In eventmesh project should define default date format pattern in jsonutil. @mxsm 
   eg. objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"))



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "jonyangx (via GitHub)" <gi...@apache.org>.
jonyangx commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103786821


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -39,10 +41,9 @@ public class JsonUtils {
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     static {
-        OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
-            .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
         OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
-
+        OBJECT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        OBJECT_MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

Review Comment:
   In eventmesh project should define default date format pattern in jsonutil. @mxsm 
   eg. objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"))
   and objectMapper.setDateFormat(xxx)



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#issuecomment-1426969220

   @jonyangx  Done,  PTAL~ thks


-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on a diff in pull request #3123: [ISSUE #3122]Refactor JsonUtils

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #3123:
URL: https://github.com/apache/incubator-eventmesh/pull/3123#discussion_r1103795485


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java:
##########
@@ -39,10 +41,9 @@ public class JsonUtils {
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     static {
-        OBJECT_MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
-            .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
         OBJECT_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
-
+        OBJECT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        OBJECT_MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

Review Comment:
   get it



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org