On Oct 26, 2010, at 4:13 , locky wrote:
The C++ side is setting things correctly.  My understanding is that
default values are not sent over the wire.  When building a received
message from a byte[ ] a check is done to see if required fields have
been set.  Any required field that was not sent due to having a
default value on the other side is not marked as being set and the
exception gets thrown.


This is exactly correct. You should do two things:

1. Set this field on the sending side, but you mentioned that you are already doing this.

2. Verify that the bytes you are reading in on one side match the bytes being sent. I usually get this error when there is some sort of message handling error. For example, if you pass protobuf an empty array, you'll get this error message. You should write out the bytes that you are writing, and the bytes that you are reading and verify that they match. Also verify that the size you are passing in matches.

There is a difference between an unset field with a default value of "" and a set field with a value of "". The .hasProperty() method will return true for the set field, and false for the unset field. Thus, these messages are serialized differently.

Hope this helps,

Evan

--
Evan Jones
http://evanjones.ca/

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

Reply via email to