How are you passing the string from C++ to Java? The empty string makes me think you are using C-strings, and null termination is causing the serialization to be truncated. Empty strings will have a length delimiter which ends up getting serialized as the null character.
On Tue, Aug 14, 2012 at 8:41 AM, Milad Rezaei Fili < milad.rezaei.f...@gmail.com> wrote: > Hi, > > I have write a program and serialized an object by C++ and > then I can parse the exact serialized bytes by > C++ without error. > This scenario is correct and working well. > > But when I try to parse these bytes by Java > then it tell me following exception : > > - While parsing a protocol message, > the input ended unexpectedly in the middle of a field. > This could > mean either than the input has been truncated > or that an embedded message misreported its own length. > > and this exception happens when I set a field to > ""(empty string) in C++ serializer. > > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to protobuf@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. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@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.