Boost logo

Boost Users :

From: Cyril (cyril.delmas_at_[hidden])
Date: 2007-07-05 08:38:44


Hello all,
I have some trouble using boost::serialization : this code

==============
try {
        std::stringstream erroneousStream;
        erroneousStream << "not a message ! @@@";
        boost::archive::text_iarchive input(erroneousStream);
        Message* deserializedMessage;
        input >> deserializedMessage; // failure
} catch (boost::archive::archive_exception& e){
        std::cerr << e.what() << std::endl;
} catch (std::exception& e) {
        std::cerr << e.what () << std::endl;
} catch(...) {
        failmsg("unexpected !");
}
===============

fails with a bad alloc exception. I don't think this is a normal
behavior. So, what can I do to make this code fail correctly (with an
archive_exception or even better with a serialization_exception) ? I
must precise that in a normal scenario (with a real serialized message,
this works perfectly well ! Any other idea ?

Tanks in advance for you answers.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net