The most common issue with Java and extensions is not passing an
ExtensionRegistry containing the extensions you want to the deserialization
method. However, you mention that the parse is failing: if you didn't
register the extensions, or didn't use an extension registry, then the data
would simply be ignored. If you're getting an
InvalidProtocolBufferException, the parse failure indicates either you are
parsing bad data, or one of the required fields has not been set.

If that doesn't get you going in the right direction, can you send a short
code snippet?

On Fri, Apr 1, 2011 at 9:06 AM, Ahab <ahabco...@yahoo.co.uk> wrote:

> I've been using protocols for a while, and just moved to extensions
> lasts week.  Deserialising out of a byte[] back into my Batch object
> is now failing - protos below.  I am looking in Eclipse and it is
> struggling with the repeat batchData objects - and my test is
> failing.  They end up not being retrievable after deserialisation.  I
> can see the elements are present before serialisation, but are there
> once they come back out.
>
> Is this all supported, am I doing anything wrong?
>
> Thanks in advance.
>
> message GenericData {
>    // Should key be an enum - I think so - part of the contract
>    required string idKey = 1;
>    enum DataType {
>        INTEGER = 1 ;
>        STRING = 2 ;
>        START = 3;
>        END = 4 ;
>        TIMING = 5;
>    }
>    required DataType dataType = 2;
>
>    optional int32 intType = 3 [default = 0];
>    optional string strType = 4 [default = ""];
>    optional double startTime = 5 [default = 0];
>    optional double stopTime = 6 [default = 0];
> }
>
> message Batch {
>    required string idRequest = 1;
>    required string idClient = 2;
>    enum AppType {
>        A = 0;
>        B = 1;
>    }
>    required AppType idApplication = 3 [ default = A ];
>    optional string appInstance = 4;
>
>    extensions 100 to 199;
> }
>
> extend Batch {
>    repeated GenericData batchData = 100;
>    repeated TaskList taskList = 101;
> }
>
> I can send code too - but hoping to get quick steer on whether I am
> doing something badly wrong.
>
> --
> 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.

Reply via email to