Re: [protobuf] Dynamic Message Processing, Java vs. C++

2011-08-27 Thread Jason Hsueh
It appears that the C++ listener code supports multiple types, but assumes that the correct type can be determined by checking if parsing the serialized string returns successfully. This is not a reliable way to detect message types: in fact ParseFromString() only fails if the serialized data is

Re: [protobuf] Dynamic Message Processing, Java vs. C++

2011-08-27 Thread Nader Salehi
If I understand correctly, you are talking about two separate issue. One is that I use of ParseFromString() is unreliable. The other one is that I should switch to self describing messages. The latter is not feasible for now; I receive serialized PB messages that do not contain their type name,

Re: [protobuf] Dynamic Message Processing, Java vs. C++

2011-08-27 Thread Jason Hsueh
No, the issue is one and the same. You cannot receive arbitrary serialized bytes and determine what the message type is. You can do something heuristically, but there is no way for you to be absolutely certain of the message type simply by looking at encoded bytes. Specific points in the code:

Re: [protobuf] Dynamic Message Processing, Java vs. C++

2011-08-27 Thread Nader Salehi
Thanks for looking into the code. Please see my comments inline. On 8/27/2011 17:07 Jason Hsueh writes: No, the issue is one and the same. You cannot receive arbitrary serialized bytes and determine what the message type is. You can do something heuristically, but there is no way for you to

Re: [protobuf] Dynamic Message Processing, Java vs. C++

2011-08-27 Thread Jason Hsueh
On Sat, Aug 27, 2011 at 6:00 PM, Nader Salehi sal...@alumni.usc.edu wrote: Thanks for looking into the code. Please see my comments inline. On 8/27/2011 17:07 Jason Hsueh writes: No, the issue is one and the same. You cannot receive arbitrary serialized bytes and determine what the

Re: [protobuf] Dynamic Message Processing, Java vs. C++

2011-08-27 Thread Jason Hsueh
Sorry, I guess it's not clear if you know the message type or not. But the issue is that you're getting some arbitrary message type out of the transmitted FileDescriptorSet (in fact, any FileDescriptorSet that's ever been received), not the type you want. It's not clear from your code how the C++