| Bug #92264 | JsonParser puts unnecessary maximum limit on JsonNumber to 10 digits | ||
|---|---|---|---|
| Submitted: | 1 Sep 2018 10:07 | Modified: | 17 Sep 2018 17:45 |
| Reporter: | Vladimir Marinov | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | 8.0.12 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | JsonParser, parseNumber, X DevAPI | ||
[4 Sep 2018 8:00]
MySQL Verification Team
Hello Vladimir, Thank you for the report! regards, Umesh
[17 Sep 2018 17:45]
Daniel So
Posted by developer: Added the following entry to the Connector/J 8.0.13 changelog: "Connector/J threw a WrongArgumentException when it encountered a JSON number with more than ten digits. This was due to an error in the JSON parser, which has now been fixed."

Description: WrongArgumentException exception is thrown when calling com.mysql.cj.xdevapi.Collection.add(String... jsonStrings) with JSON string containing JSON Number with more than 10 digits. ----- Caused by: com.mysql.cj.exceptions.WrongArgumentException: Base part ''{0}'' is too long, only 10 digits are allowed. ... at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) at com.mysql.cj.xdevapi.JsonParser.parseNumber(JsonParser.java:466) at com.mysql.cj.xdevapi.JsonParser.nextValue(JsonParser.java:317) at com.mysql.cj.xdevapi.JsonParser.parseDoc(JsonParser.java:190) ... How to repeat: Session mySession = new SessionFactory().getSession(...); Schema myDb = mySession.getSchema(...); Collection myColl = myDb.createCollection(...); // Insert documents myColl.add("{\"dataCreated\": 1546300800000}").execute(); Suggested fix: Extending DbDoc and with the help of Jackson ObjectMapper I was able to workaround this issue, but it will be better to have an option to plug any library for JSON serialization/deserialization.