Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006392 [Hessian] minor always 04-16-21 06:23 10-30-23 02:24
Reporter garsonchan View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 4.0.63
Summary 0006392: Hessian can not support a class with a filed which is LocalDate when serializing
Description We get an "StackOverflow Exception" while trying to serialize a class with a field which is LocalDate.

We create a small testcase to reproduce the bug. The testcase uses JavaSerializer and Hessian2Output to serialize a class A, which has a field called a_filed.

We finally find that JavaSerializer would use java.time.LocalDate#writeReplace to serialize LocalDate,which returns an object of java.time.Ser.The class of java.time.Ser has a field ,which is the object of LocalDate that class A has(a_filed).
So when JavaSerializer serialzes class A, it would use writeObject and cause an endless loop between serialzing a_filed and the object of java.time.Ser that java.time.LocalDate#writeReplace returns.
Additional Information The Exception stack is below:
Exception in thread "main" java.lang.StackOverflowError
    at com.caucho.hessian.io.SerializerFactory.getSerializer(SerializerFactory.java:260)
    at com.caucho.hessian.io.SerializerFactory.getObjectSerializer(SerializerFactory.java:217)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:463)
    at com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:299)
    at com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:218)
    at com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:172)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:465)
    at com.caucho.hessian.io.WriteReplaceSerializer.writeObject(WriteReplaceSerializer.java:167)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:465)
    at com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:299)
    at com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:218)
    at com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:172)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:465)
    at com.caucho.hessian.io.WriteReplaceSerializer.writeObject(WriteReplaceSerializer.java:167)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:465)
    at com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:299)
...
Attached Files  A.java [^] (607 bytes) 04-16-21 06:23

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
04-16-21 06:23 garsonchan New Issue
04-16-21 06:23 garsonchan File Added: A.java
01-09-23 23:20 oralie Note Added: 0007143
03-26-23 21:11 zelda Note Added: 0007152
03-26-23 21:11 zelda Note Deleted: 0007152
05-16-23 19:51 andree23 Note Added: 0007165
06-12-23 18:42 Mnaisoa Note Added: 0007181
06-16-23 21:42 mike34 Note Added: 0007183
10-30-23 02:24 timothyferriss Note Added: 0007298
11-14-23 17:30 ferg Note Deleted: 0007143
11-14-23 17:30 ferg Note Deleted: 0007165
11-14-23 17:30 ferg Note Deleted: 0007181
11-14-23 17:30 ferg Note Deleted: 0007183
11-14-23 17:30 ferg Note Deleted: 0007298


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
46 total queries executed.
31 unique queries executed.
Powered by Mantis Bugtracker