Re: [protobuf] Error while using parseFrom

2012-06-27 Thread Evan Jones
On Jun 26, 2012, at 11:08 , d34th4ck3r wrote:
> What is it that I am doing wrong?

Protocol buffers are a *binary* format. Those funny characters at the end of 
the string are probably part of the message, and you should leave them there. 
You also should not be passing them around as strings. They need to be passed 
as bytes. If you need to call getBytes("UTF-8") you are doing something wrong. 
Good luck,

Evan

--
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 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.



[protobuf] Error while using parseFrom

2012-06-27 Thread d34th4ck3r
Hi,

I am trying to receive response from server which a protobuf, which is 
encoded, and there are "{" at the end of string so, I am truncating string 
using :

registerAgentResponse_string=registerAgentResponse_string.replace("{","");

then I convert this to byteArray using :

registerAgentResponse_byte =registerAgentResponse_string.getBytes("UTF-8");

and then I use:

RegisterAgentResponse.parseFrom(registerAgentResponse_byte)

RegisterAgentResponse is my protobuf.

This gives following error:

com.google.protobuf.InvalidProtocolBufferException: 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.

What is it that I am doing wrong?

Thanks,
Gautam

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/BTiHFpYLTvcJ.
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.