#596 Poco::JSON: Parsing long integer (int64) value fails.

Documentation
closed
nobody
1
2012-12-03
2012-10-18
Markus Werner
No

Summary:
Trying to parse this JSON "{\"m\":\"Hello World\",\"t\":1350595214594}" throws an Exception:
Poco::Exception("Not a valid integer: 1350595214594")

Environment:
Visual Studio 2010 Professional
Windows 7 (64-bit)
Multithreaded-Debug (/MTd)
Win32 (/D "WIN32")
POCO_HAVE_INT64 == 1

Sample Code:
std::string msg = "{\"m\":\"Hello World\",\"t\":1350595214594}";
Poco::JSON::DefaultHandler handler;
Poco::JSON::Parser parser;
parser.setHandler(&handler);
parser.parse(msg);
Poco::DynamicAny result = handler.result();

1 Attachments

Discussion

  • Alex Fabijanic
    Alex Fabijanic
    2012-10-18

    The problem is in Poco:Token which calls NumberParser::parse(), which calls 32 bit int parser instead of 64 bit. Not sure how did this slip through tests but we'll take care of it for the next bugfix release.

     
  • Alex Fabijanic
    Alex Fabijanic
    2012-10-19

    • status: open --> accepted
     
  • Alex Fabijanic
    Alex Fabijanic
    2012-10-19

    patch attached

     
  • Alex Fabijanic
    Alex Fabijanic
    2012-12-03

    fixed in 1.5.0

     
  • Alex Fabijanic
    Alex Fabijanic
    2012-12-03

    • status: accepted --> closed