Anonymous | Login | Signup for a new account | 11-21-2024 22:22 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0005553 | [Hessian] | minor | always | 10-11-13 03:30 | 08-14-23 08:01 | |||||||
Reporter | mbutov | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Version | 4.0.28 | |||||||||
Summary | 0005553: Deserialization fails if there are fields of the same name in the class and its superclass. | |||||||||||
Description |
TEST import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Serializable; import org.junit.Test; import com.caucho.hessian.io.Hessian2Input; import com.caucho.hessian.io.Hessian2Output; public class HessianTest { static class A implements Serializable { private String x = "x"; @Override public String toString() { return "A.x=" + x; } } static class B extends A { private int x = 1; @Override public String toString() { return super.toString() + ",B.x='" + x; } } @Test public void testSameFieldName() throws Throwable { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); B b1 = new B(); System.out.println(b1); Hessian2Output output = new Hessian2Output(buffer); output.writeObject(b1); output.flush(); Hessian2Input input = new Hessian2Input(new ByteArrayInputStream(buffer.toByteArray())); B b2 = (B) input.readObject(); System.out.println(b2); } } OUTPUT com.caucho.hessian.io.HessianFieldException: org.proxyremoting.HessianTest$B.x: expected integer at 0x1 java.lang.String (x) [C\x1forg.proxyremoting.HessianTest$B\x92\x01x\x01x`\x91] \x01 [x] at com.caucho.hessian.io.UnsafeDeserializer.logDeserializeError(UnsafeDeserializer.java:786) at com.caucho.hessian.io.UnsafeDeserializer$IntFieldDeserializer.deserialize(UnsafeDeserializer.java:565) at com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:239) at com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:150) at com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2219) at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2140) at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2124) at org.proxyremoting.HessianTest.testSameFieldName(HessianTest.java:50) Caused by: com.caucho.hessian.io.HessianProtocolException: expected integer at 0x1 java.lang.String (x) [C\x1forg.proxyremoting.HessianTest$B\x92\x01x\x01x`\x91] \x01 [x] at com.caucho.hessian.io.Hessian2Input.error(Hessian2Input.java:2943) at com.caucho.hessian.io.Hessian2Input.expect(Hessian2Input.java:2880) at com.caucho.hessian.io.Hessian2Input.readInt(Hessian2Input.java:825) at com.caucho.hessian.io.UnsafeDeserializer$IntFieldDeserializer.deserialize(UnsafeDeserializer.java:561) ... 32 more |
|||||||||||
Additional Information | ||||||||||||
Attached Files | ||||||||||||
|
There are no notes attached to this issue. |
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
42 total queries executed. 30 unique queries executed. |