You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "HelloToGithub (via GitHub)" <gi...@apache.org> on 2023/03/09 06:41:49 UTC

[GitHub] [dubbo] HelloToGithub opened a new issue, #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

HelloToGithub opened a new issue, #11775:
URL: https://github.com/apache/dubbo/issues/11775

   <!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
   
   <!-- For all design discussions please continue. -->
   使用官方dubbo-example 
   1、dubbo 3.1.7
   2、serialization 配置为fastjson2
   对象包含集合 使用Arrays.asList创建对象的传输的时候 服务接收的时候会被解析成HashMap 使用 new ArrayList<>()不会有问题
   例子如下:
   Task,class  run
   `        ParamsDTO paramsDTO = new ParamsDTO();
           ParamsItemDTO paramsItemDTO = new ParamsItemDTO();
           paramsItemDTO.setA("aaa");
           paramsDTO.setParamsItems(Arrays.asList(paramsItemDTO));
           demoService.sayHello(paramsDTO);
   //        List<ParamsItemDTO> a = new ArrayList<>();
   //        a.add(paramsItemDTO);
   //        paramsDTO.setParamsItems(a);
   //        demoService.sayHello(paramsDTO);
   `
   ParamsDTO 
   `@Data
   public class ParamsDTO implements Serializable {
       private List<ParamsItemDTO> paramsItems;
   
   }`
   
   ParamsItemDTO 
   `@Data
   public class ParamsItemDTO implements Serializable {
   
       private String a;
   }
   `
   
   ![image](https://user-images.githubusercontent.com/15622677/223939928-679b5156-b09e-4429-935e-c1e1ea37e0d5.png)
   ![image](https://user-images.githubusercontent.com/15622677/223939981-7a9e07fd-770a-4273-bac7-24b76243c827.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: notifications-unsubscribe@dubbo.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] HelloToGithub closed issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "HelloToGithub (via GitHub)" <gi...@apache.org>.
HelloToGithub closed issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap
URL: https://github.com/apache/dubbo/issues/11775


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] HelloToGithub commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "HelloToGithub (via GitHub)" <gi...@apache.org>.
HelloToGithub commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1475503609

   > https://github.com/alibaba/fastjson2/releases/tag/2.0.26 问题已修复,请用新版本
   
   收到。感谢。


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wenshao commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "wenshao (via GitHub)" <gi...@apache.org>.
wenshao commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1465255640

   https://github.com/alibaba/fastjson2/releases/tag/2.0.25
   
   2.0.25版本发布了,问题已经修复,请帮忙验证。


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] HelloToGithub commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "HelloToGithub (via GitHub)" <gi...@apache.org>.
HelloToGithub commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1467434404

   > 
   
   经验证已修复。感谢。什么时候发布release 版本


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] HelloToGithub commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "HelloToGithub (via GitHub)" <gi...@apache.org>.
HelloToGithub commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1465443818

   > > https://github.com/alibaba/fastjson2/releases/tag/2.0.25
   > > 2.0.25版本发布了,问题已经修复,请帮忙验证。
   > 
   > 升级到2.0.25 貌似问题还是存在 具体信息如下 com.alibaba.fastjson2.JSONB#parseObject() ![image](https://user-images.githubusercontent.com/15622677/224595860-3bbd8b65-fb91-4e7d-b98a-b6ef46fe02de.png)
   > 
   > java.util.Base64.getEncoder().encodeToString(jsonbBytes): knNvcmcuYXBhY2hlLmR1YmJvLnNwcmluZ2Jvb3QuZGVtby5QYXJhbXNEVE8Apn9UcGFyYW1zSXRlbXMBkmNqYXZhLnV0aWwuQXJyYXlzJEFycmF5TGlzdAKVpn9KYQNMYWFhpaU=
   
   https://github.com/apache/dubbo/issues/11703 此issues的demo可复现
   ![image](https://user-images.githubusercontent.com/15622677/224599167-3193a2dd-d0cc-4326-bd89-82b4ddc05f33.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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wenshao commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "wenshao (via GitHub)" <gi...@apache.org>.
wenshao commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1467278994

   https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.26-SNAPSHOT/
   问题重现并修复,请帮忙用2.0.26-SNAPSHOT验证
   
   修复代码在这里 https://github.com/alibaba/fastjson2/commit/fea0ad326b21775ae35fdec79851781c7bd104ef


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wenshao commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "wenshao (via GitHub)" <gi...@apache.org>.
wenshao commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1465094964

   https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.25-SNAPSHOT/
   怀疑是因为spring aop enhancer导致的,已经做了修复,请帮忙用2.0.25-SNAPSHOT验证下


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] wenshao commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "wenshao (via GitHub)" <gi...@apache.org>.
wenshao commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1475102273

   https://github.com/alibaba/fastjson2/releases/tag/2.0.26
   问题已修复,请用新版本


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] SeasonPanPan commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "SeasonPanPan (via GitHub)" <gi...@apache.org>.
SeasonPanPan commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1463846197

   I tested, maybe it's the problem with fastjson2.
   `com.alibaba.fastjson2.JSONB#parseObject()`


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] SeasonPanPan commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "SeasonPanPan (via GitHub)" <gi...@apache.org>.
SeasonPanPan commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1465902172

   @wenshao 温老师,我不知道您在2.0.25上做了什么修复改动,可以分享吗?针对此问题并未生效。
   我测试和验证了这个问题,感觉应该在写入JSONWriter或者读取时FieldReader做改动。
   1)代码在处理Arrays.ArrayList和普通ArrayList时,序列化ArrayList并没有写类名,但是Arrays.ArrayList当作普通类写入类名,读取时就会当作普通Object处理。
   这里我想到的解决方案是:**把所有List的实现都不写类名序列化**。我试了下可以生效。
   2)代码在反序列化时,asm生成的代码中,处理Arrays.ArrayList字段,当作普通JsonObject处理,所以专成了HashMap。
   这个我想到的解决方案是:**Arrays.ArrayList不使用autoType处理,由他自己的itemReader处理**。
   我试了可以生效,但是这个改动比较复杂,我把握不住全局。
   期待跟温老师更进一步交流😀。
   


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] HelloToGithub commented on issue #11775: serialization配置fastjson2 Arrays.asList创建的集合对象 接收时对象会被解析成HashMap

Posted by "HelloToGithub (via GitHub)" <gi...@apache.org>.
HelloToGithub commented on issue #11775:
URL: https://github.com/apache/dubbo/issues/11775#issuecomment-1465426279

   > https://github.com/alibaba/fastjson2/releases/tag/2.0.25
   > 
   > 2.0.25版本发布了,问题已经修复,请帮忙验证。
   
   升级到2.0.25 貌似问题还是存在 具体信息如下
   com.alibaba.fastjson2.JSONB#parseObject()
   ![image](https://user-images.githubusercontent.com/15622677/224595860-3bbd8b65-fb91-4e7d-b98a-b6ef46fe02de.png)
   
   java.util.Base64.getEncoder().encodeToString(jsonbBytes):
   knNvcmcuYXBhY2hlLmR1YmJvLnNwcmluZ2Jvb3QuZGVtby5QYXJhbXNEVE8Apn9UcGFyYW1zSXRlbXMBkmNqYXZhLnV0aWwuQXJyYXlzJEFycmF5TGlzdAKVpn9KYQNMYWFhpaU=


-- 
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-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org