I get the following error when I declare 3 string fields in a sequence in 
my protocol buffer input message:

libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message 
of type "tst.pb.testInput" because it is missing required fields: strThree

Sample message:
package tst.pb.Test;
message TestInput {
    required string strOne = 1;
    required string strTwo = 2;
    required string *strThree *= 3;
    optional sint32 intVar1 = 4 [default = 5];
    optional sint32 intVar2 = 5 [default = -1];

Any subsequent 'required' fields defined after the 3rd string are missing 

No error occurs if the sequence of string declarations is 2 followed by a 
declaration of a different type and then the 3rd string decl.  For 

message TestInput {
    required string strOne = 1;
    required string strTwo = 2;
    optional sint32 intVar1 = 3 [default = 5];
    optional sint32 intVar2 = 4 [default = -1];
    required string *strThree *= 5;
... results in No Error!

Changing the 3rd 'required' string in the sequence to optional eliminates 
the error but the value of the 3rd string becomes the 'default' value, 
either declared or a default 'null' string, regardless of a value assinged 
in the input file.

Also, the additional 'optional' fields, trailing the 3-string sequence, are 
assigned their respective 'default' values, either declared or based on 
'type', not values assigned in the input file.

I'm using protobuf-2.4.1 on Windows 7, 64-bit, w/CodeBlocks C++ project.  
Have not attempted this w/2.5.0 because no mention of any corrections in 
the release notes and my project right now appears fixed using 2.4.1.

Note:  I'm reading the input message buffer as follows:
  tst::pb::Test::TestInput input;
  std::ifstream inputStream;
  bool rc = input.ParseFromIstream(&inputStream);
  if (rc == false)
      printf("ERROR! Input ParseFromIstream failed!\n");

Has a problem similar to this  been seen by others?  Or am I missing 

Thanks for any insight.

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to