You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/03/27 06:43:51 UTC

[GitHub] zonghaishang commented on issue #174: dubbo������������bean���������������������������

zonghaishang commented on issue #174: dubbo调用中,bean反序列化后属性丢失
URL: https://github.com/apache/incubator-dubbo/issues/174#issuecomment-376414910
 
 
   @qingfengpu
   
   I have tested the problem without you saying, Here is my test code:
   
   ``` java
   public class Father implements Serializable {
       public int age;
       public String name;
   }
   public class Son extends Father {
       public String name;
   }
       @Test
       public void serialize_inherited_model_then_deserialize() throws Exception {
   
           Son son = new Son();
           son.age = 40;
           son.name = "jason";
   
           ByteArrayOutputStream bout = new ByteArrayOutputStream();
           Hessian2Output out = new Hessian2Output(bout);
   
           out.writeObject(son);
           out.flush();
   
           ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
           Hessian2Input input = new Hessian2Input(bin);
           Son deserializeSon = (Son)input.readObject(Son.class);
           assertTrue(deserializeSon != null);
           assertEquals(40, deserializeSon.age);
           assertEquals("jason", deserializeSon.name);
       }
   ```
   ![image](https://user-images.githubusercontent.com/15549777/37950930-245ea4b8-31cd-11e8-9c76-a7f190b018ba.png)
   
   I'm using dubbo 2.6.1, please attach your code and dubbo version, thanks.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services