Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

serializing doubles fails #26

Closed
rightisleft opened this issue Jun 28, 2015 · 3 comments
Closed

serializing doubles fails #26

rightisleft opened this issue Jun 28, 2015 · 3 comments

Comments

@rightisleft
Copy link
Contributor

Example Code: https://github.com/rightisleft/dartson_double

I'm building up a DTO that accepts a double for a value. When serializing from dart, i get the following error:

/usr/local/Cellar/dart/1.10.1/libexec/bin/dart --ignore-unrecognized-flags --checked --package-root=/Users/jmurphy/projects/dartson_double/packages --enable-vm-service:50734 --trace_service_pause_events /Users/jmurphy/projects/dartson_double/bin/main.dart
Observatory listening on http://127.0.0.1:50734
Unhandled exception:
Stack Overflow
#0      StringBuffer.write (dart:core-patch/string_buffer_patch.dart:57)
#1      StringBuffer.StringBuffer (dart:core-patch/string_buffer_patch.dart:52)
#2      MirrorSystem.getName (dart:mirrors-patch/mirrors_patch.dart:63)
#3      Dartson._serializeObject (package:dartson/dartson.dart:47:21)
#4      Dartson._setField (package:dartson/dartson.dart:78:14)
#5      Dartson._serializeObject.<anonymous closure> (package:dartson/dartson.dart:121:11)
#6      _CompactLinkedHashMap.forEach (dart:collection-patch/compact_hash.dart)
#7      Dartson._serializeObject (package:dartson/dartson.dart:149:35)
#8      Dartson._setField (package:dartson/dartson.dart:78:14)
#9      Dartson._serializeObject.<anonymous closure> (package:dartson/dartson.dart:121:11)
#10     _CompactLinkedHashMap.forEach (dart:collection-patch/compact_hash.dart)
#11     Dartson._serializeObject (package:dartson/dartson.dart:149:35)
#12     Dartson._setField (package:dartson/dartson.dart:78:14)
#13     Dartson._serializeObject.<anonymous closure> (package:dartson/dartson.dart:121:11)
...
...
#14     MapView.forEach (dart:collection/maps.dart:194)
#15     Dartson._serializeObject (package:dartson/dartson.dart:117:35)
#16     Dartson.serialize (package:dartson/dartson.dart:78:14)
#17     Dartson._serializeList.<anonymous closure> (package:dartson/dartson.dart:96:30)
#18     MappedListIterable.elementAt (dart:_internal/iterable.dart:413)
#19     ListIterable.toList (dart:_internal/iterable.dart:219)
#20     Dartson._serializeList (package:dartson/dartson.dart:96:44)
#21     Dartson.serialize (package:dartson/dartson.dart:72:14)
#22     main (file:///Users/jmurphy/projects/dartson_double/bin/main.dart:13:33)
#23     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:255)
#24     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.d

Process finished with exit code 255
  • If i change field price in TransactionVO to a type of num, the errors persists
  • If i change field price in TransactionVO to a type of int, and assign an integer value, the errors resolves itself.
@eredo eredo closed this as completed in 23b2ba2 Jul 4, 2015
@rightisleft
Copy link
Contributor Author

patch works like a charm! might want to update supported types of the readme file - i assumed double would be supported :(

@giolaq
Copy link

giolaq commented Aug 9, 2015

Serializing doubles fails again @eredo

@eredo
Copy link
Owner

eredo commented Aug 12, 2015

@joaobiriba I saw your post on stackoverflow and took a look at your code. There's an issue with using doubles in properties which type is defined as "num". I opened an issue #27

If possible please use the "double" type as long as the bug isn't fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants