Anonymous | Login | Signup for a new account | 11-23-2024 23:07 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 | |||||||
0004069 | [Hessian] | crash | always | 06-04-10 05:49 | 07-18-23 02:04 | |||||||
Reporter | raggatt2000 | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Version | 4.0.7 | |||||||||
Summary | 0004069: IndexOutOfBoundsException when deserializing Google Collections | |||||||||||
Description |
I?m getting an issue when deserializing classes containing Google Collections classes - Hessian throws an IndexOutOfBoundsException when calling readObject() on the Hessian2Input instance. I?ve attached an example class which replicates the exception. I?m running using the following: Java 6 (jdk 1.6.0_17) Google Collections 1.0 Hessian 4.0.7 - (note: also affects 4.0.x) As far as I can tell, the exception seems to occur as a result of one of/a combination of the following: - ImmutableMap implements custom serialization methods writeReplace() and readResolve() - A single instance being referenced from multiple locations Resulting exception is: Exception in thread "main" com.caucho.hessian.io.HessianFieldException: com.ml.HessianTest.test: com.ml.HessianTest cannot be assigned from null at com.caucho.hessian.io.UnsafeDeserializer.logDeserializeError(UnsafeDeserializer.java:774) at com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:421) 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:2188) at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2109) at com.caucho.hessian.io.MapDeserializer.readMap(MapDeserializer.java:114) at com.caucho.hessian.io.SerializerFactory.readMap(SerializerFactory.java:522) at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2079) at com.ml.HessianTest.main(HessianTest.java:51) Caused by: java.lang.IndexOutOfBoundsException: Index: 80, Size: 73 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1790) at com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:417) ... 8 more Java code for replicating below: import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.Serializable; import java.util.Map; import com.caucho.hessian.io.Hessian2Input; import com.caucho.hessian.io.Hessian2Output; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; public class HessianTest implements Serializable { private final Map<String, String> map; private final HessianTest test; private HessianTest(Map<String, String> map, HessianTest test) { this.map = map; this.test = test; } public static void main(String[] args) throws IOException { Map<String, HessianTest> map = Maps.newHashMap(); HessianTest lastTest = null; //seems to start failing when limit set to 18 for (int i = 0; i < 18; i++) { HessianTest test = new HessianTest(ImmutableMap.of("id" + i, "id" + i), lastTest); //following line works fine - probably indicating //that the issue is with the google collection //serialization routine //HessianTest test = new HessianTest(Collections.singletonMap("id" + i, "id" + i), lastTest); map.put("id" + i, test); lastTest = test; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); Hessian2Output oos = new Hessian2Output(baos); oos.writeObject(map); oos.close(); baos.close(); byte[] input = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(input); Hessian2Input ois = new Hessian2Input(bais); ois.readObject(); } private static final long serialVersionUID = 1L; } |
|||||||||||
Additional Information | ||||||||||||
Attached Files |
HessianTest.java [^] (1,605 bytes) 06-04-10 05:49 IdentityIntMap.java [^] (6,809 bytes) 06-08-10 11:24 |
|||||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
45 total queries executed. 32 unique queries executed. |