Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003920 [Hessian] major always 02-27-10 17:54 02-08-16 23:24
Reporter aloksingh View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 4.0.3
Summary 0003920: BigDecimal objects are incorrectly serialized
Description Serializing/Deserializing BigDecimal objects doesn't work correctly

Ex:
BigDecimal object = new BigDecimal("12474639.945458954");
Hessian2Output os = new Hessian2Output(null);
os.setSerializerFactory(new SerializerFactory());
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
os.init(buffer);
os.writeObject(object);
os.close();
byte[] bytes = buffer.toByteArray();

 Hessian2Input is = new Hessian2Input(new ByteArrayInputStream(bytes));
 BigDecimal newObject = (T) is.readObject();
 is.close();

assert object.equals(newObject)

The final assertion should not fail.
Additional Information
Attached Files

- Relationships

- Notes
(0004650)
qrilka
07-01-10 05:46

I'm using hessian 4.0.7
Looking into the source code shows that serilizers/deserilizers for BigDecimal are commented out (quite a strange decision from my p.o.v.) but it's quite easy to solve - just create META-INF/hessian/serializers and META-INF/hessian/deserializers with corresponding classnames. An example for that can be seen in resin.jar (for resin4)
 
(0004680)
p_wright
07-22-10 09:59

I can also confirm this with 4.0.7... the result is a BigDecimal with a value of 0.0... which causes some problems since we use BigDecimals to accurately represent sums of money.
 
(0004709)
groblochon
08-13-10 01:16

I solve this bug with adding files META-INF/hessian/serializers with 'java.math.BigDecimal=com.caucho.hessian.io.StringValueSerializer' and META-INF/hessian/deserializers with 'java.math.BigDecimal=com.caucho.hessian.io.BigDecimalDeserializer'.
 
(0006673)
Nathanael Sommer-Koch
02-08-16 23:24

We just encountered the same problem in our project. How come this issue is still not resolved after 6 years?
And why is there a Deserializer but no Serializer?
 
(0006674)
Nathanael Sommer-Koch
02-08-16 23:24

We just encountered the same problem in our project. How come this issue is still not resolved after 6 years?
And why is there a Deserializer but no Serializer?
 

- Issue History
Date Modified Username Field Change
02-27-10 17:54 aloksingh New Issue
07-01-10 05:46 qrilka Note Added: 0004650
07-01-10 05:46 qrilka Issue Monitored: qrilka
07-22-10 09:59 p_wright Note Added: 0004680
08-13-10 01:16 groblochon Note Added: 0004709
12-08-10 01:53 ccampo Issue Monitored: ccampo
02-19-12 00:16 babasmith Issue Monitored: babasmith
02-08-16 23:24 Nathanael Sommer-Koch Note Added: 0006673
02-08-16 23:24 Nathanael Sommer-Koch Note Added: 0006674


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