sgzwiz / jsonplugin

Automatically exported from code.google.com/p/jsonplugin
0 stars 1 forks source link

null shouldn't convert to zero for Objects #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Submit null for a parameter that is Integer, Long, Boolean, etc
2. JSONPopulator converts this to 0, 0, false, etc

What is the expected output? What do you see instead?

JSONPopulator ought to preserve the null, since Integer, Long, Boolean, etc
allow null.

Obviously, int, long, boolean, etc do not allow null, so conversion makes
sense in this case.  Though one could argue that an error should be thrown
instead, since using primitives implies that null is not acceptable.

Assigning to musachy because he made this change in rev 75, so he needs to
evaluate whether or not my interpretation makes sense.

I can check in the fix, if it's approved.

Original issue reported on code.google.com by jjlin...@gmail.com on 19 Mar 2009 at 6:04

GoogleCodeExporter commented 9 years ago
I agree, fixed in trunk, only primitive types will be converted from null to 
their
default value.

Original comment by musa...@gmail.com on 28 Jul 2009 at 5:03

GoogleCodeExporter commented 9 years ago
I updated to rev 99, but I can't find where you made the change.  I attached my 
patch.

Original comment by jjlin...@gmail.com on 10 Aug 2009 at 8:58

Attachments:

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/jsonplugin/source/detail?r=95

Original comment by musa...@gmail.com on 10 Aug 2009 at 9:11