For full visibility:
It turns out that the error was on my side. Apparently ProtoStuff can talk
different dialects. ProtoStuff and ProtoBuf.
It just depends on what IOUtil implementation you use.
When you read for instance, either use:
ProtobufIOUtil.mergeFrom(inputStream, t, schema, buffer);
or
ProtostuffIOUtil.mergeFrom(inputStream, t, schema, buffer);
This wasn't really clear from their side. I hade no clue. We had of course
been using ProtostuffIOUtil -- when we should have used ProtobufIOUtil
since we are talking between different implementations (ProtoStuff
protobuf-net).
Best,
Johannes
On Tuesday, October 14, 2014 7:55:58 PM UTC+2, Johannes Elgh wrote:
Hello everyone,
Firstly I need to apologize for any misuse or misunderstand of terms and
concepts. I'm mostly familiar with the Protocol Buffer implementations
protostuff and protobuf-net.
I have a case that two different implementations (the C# one: protobuf-net
and the Java one: protostuff) do differently and I'd like to know which way
is the correct according to the Protocol Buffers specification.
I have these messages:
message A {
optional string someField = 2;
optional Location location = 4;
}
message Location {
optional Coordinate coordinate = 1;
optional string city = 2;
}
message Coordinate {
...
}
In the following case we have an object A, with a populated Location with
coordinate
= null and city = someCity.
When protobuf-net (a client) sends this object A (populated as described
above) to protostuff (the backend) it sends 0x0 in the place of the
coordinate.
This results into that protostuff reads a 0 whilst populating Location,
and therefore thinks that Location is done. When protostuff then reads
the next field number it finds 2, city, which has the same number as
someField in A and populates that field instead (city overwrites someField
).
So the problem is that protobuf-net sends 0x0 for a null nested messages
whereas protostuff doesn't even expect it to be there (since it's null).
Best regards,
Johannes
--
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.
For more options, visit https://groups.google.com/d/optout.