[SERVER-9414] mongo::fromjson failed Created: 20/Apr/13 Updated: 07/Apr/23 Resolved: 24/Apr/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client |
| Affects Version/s: | 2.4.1, 2.4.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Frédéric Logier | Assignee: | Shaun Verch |
| Resolution: | Done | Votes: | 0 |
| Labels: | driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux |
||
| Attachments: |
|
| Operating System: | ALL |
| Steps To Reproduce: | string json = " { \"A\": 1, \"B\":2 }"; string json = " { \"A\": 1 , \"B\":2 }"; |
| Participants: |
| Description |
|
mongo::fromjson is failed if there is no white space before comma when the value is an int. |
| Comments |
| Comment by Thomas Renoth [ 12/Sep/13 ] |
|
This has to do with fromjson using strtod which parses numbers based on the system locale. If your locale (de_DE.UTF-8 in my case) happens to use a comma as decimal separator you end up with this error. Oddly enough I haven't managed to reproduce this with a plain cpp file; it only happens in a Qt project we have. A workaround is to change LC_NUMERIC to a locale that does not use a comma as decimal separator. |
| Comment by Shaun Verch [ 24/Apr/13 ] |
|
Hi Fred, Thanks for the response. I'll go ahead and close the ticket for now. If there's any way we could help further to diagnose the cause of this issue feel free to let us know! Thanks! |
| Comment by Frédéric Logier [ 24/Apr/13 ] |
|
Hi Shaun, 2013/4/23 Shaun Verch (JIRA) <jira@mongodb.org> |
| Comment by Shaun Verch [ 23/Apr/13 ] |
|
Hi Frédéric, I wasn't able to reproduce this either in our unit tests for the json parser or in a small C++ application. Could you attach a file to this ticket containing a small example that fails? I've attached the test code I used that works with the 2.4.1 and 2.4.2 versions of the C++ driver. Thanks, |