Hi all,
I have a strange behavior with java release 2.3.0 and I need your help:
Protos.proto:
...
message Request {
required Api api_call = 1;
extensions 100 to 200;
}
message RefundRequest {
extend Request {
optional RefundRequest refund_request = 100;
}
required int32 orderId = 1;
}
...
Client (java):
Protos.RefundRequest refundRequest =
Protos.RefundRequest.newBuilder()
.setOrderId(2)
.build();
Protos.Request request =
Protos.Request.newBuilder()
.setApiCall(Protos.Api.REFUND)
.setExtension(Protos.RefundRequest.refundRequest,
refundRequest)
.build();
Server (java):
...
byte[] data; // data is properly initialized with all bytes transmitted
over the wire.
Protos.Request request = Protos.Request.parseFrom(data);
// request.getApiCall() is correct. now I need to get transmitted order
Id. I do expect to have 2.
ExtensionRegistry registry = ExtensionRegistry.newInstance();
registry.add(Protos.RefundRequest.refundRequest);
RefundRequest refundRequest = Protos.RefundRequest.parseFrom(
data, registry
);
...
here is the problem:
refundRequest.getOrderId() returns always "1" ?!? no exceptions during
encoding, transmitting and receiving the data.
What I do wrong?
--
You received this message because you are subscribed to the Google Groups "Protocol
Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.