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 04-16-21 06:23
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


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