avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Winston <josephwinston...@gmail.com>
Subject C++ sample in 1.7.6 fails with EOF reached using a record containing a filed with a string
Date Mon, 10 Feb 2014 01:18:15 GMT
If I have a schema that looks like this:

{"namespace": "Dummy",
"type": "record",
"name": "String",
"fields": [
    {"name": "name", 
    "type": "string",
    "default": "NONE",
    "doc": "The Name"

With a program to set and retrieve the value of the name based on generated.cc found in the
C++ documentation:

#include <cstdlib>              // for EXIT_SUCCESS
#include <stdexcept>

#include <Dummy.hpp>

#include <avro/Encoder.hh>
#include <avro/Decoder.hh>

main(int argc,
    char **argv)
  std::auto_ptr<avro::OutputStream> out = avro::memoryOutputStream();
  avro::EncoderPtr e = avro::binaryEncoder();

  Mine::String anInput;
  anInput.name = "This is a name";

  std::auto_ptr<avro::InputStream> in = avro::memoryInputStream(*out);
  avro::DecoderPtr d = avro::binaryDecoder();

  Mine::String anOutput;

     avro::decode(*d, anOutput);
  catch (std::exception& e) 
     std::cerr << e.what() 
               << std::endl;

     exit (EXIT_FAILURE);

  return EXIT_SUCCESS;

On O X 10.9.1 using clang version 3.3 (tags/RELEASE_33/final), I receive the following exception
when the program is run:

EOF reached

Is this a known issue with the C++ bindings in avro 1.7.6?
View raw message