Caucho Forums  

This forum is permanently closed because of spam. For free community support, please visit Google Groups:

Go Back   Caucho Forums > Hessian

Thread Tools Display Modes
Old 03-07-2013, 12:58 PM
Habib Habib is offline
Junior Member
Join Date: Oct 2012
Posts: 2
Default Hessian deserializer problem by inherited Fields wihr same name

Class B inheritance class A and both classes have a Field “id”. Hessian deserializer overwrite “id” from class B.

public class A implements{

protected long id = 100;

public long getId() {
return id;
public void setId(long id) { = id;


public class B extends A implements {

private long id = 200;

public long getId() {
return id;
public void setId(long id) { = id;

public long getSuperId() {
return super.getId();


public class Serializertest

* @param args
public static void main(String[] args)

ByteArrayOutputStream bos = new ByteArrayOutputStream();

Hessian2Output out = new Hessian2Output(bos);

B b = new B();

byte[] data = bos.toByteArray();
ByteArrayInputStream bin = new ByteArrayInputStream(data);
Hessian2Input in = new Hessian2Input(bin);
ArrayList list = new ArrayList();
int length = in.readInt();

for (int i = 0; i < length; i++)


b = (B) list.get(0);
System.out.println("id from class B =" + b.getId());
System.out.println("id from class A =" + b.getSuperId());
} catch (IOException e)
// TODO Auto-generated catch block

---- Output---
id from class B =100
id from class A =0
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:50 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.