Vitali Lovich created THRIFT-1758:
-------------------------------------

             Summary: bad_lexical_cast using TJSONProtocol
                 Key: THRIFT-1758
                 URL: https://issues.apache.org/jira/browse/THRIFT-1758
             Project: Thrift
          Issue Type: Bug
          Components: C++ - Library
    Affects Versions: 0.9
         Environment: boost 1.52.0
iOS 6.0
iOS simulator 6.0
            Reporter: Vitali Lovich
            Priority: Critical


try{
    std::string str("-0.003024283066062361")
    double d = boost::lexical_cast<double>(str);
    // bad_lexical_cast is thrown
} catch (const boost::bad_lexical_cast& e) {
    std::cerr << e.what() << std::endl;
}

bad_lexical_cast is thrown.  This is a problem for TJSONProtocol which relies 
on lexical_cast handling this properly.

Looking through the code, it looks to have to do something with the 
compile-time precision.

defining BOOST_LCAST_NO_COMPILE_TIME_PRECISION appears to resolve this issue 
(although at the cost of performance).

this problem also doesn't appear to happen all the time with the same input 
data.  sometime's it's reproducible every time, other times it isn't.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to