In Java, you need to make sure that you provide an ExtensionRegistry when
you parse the message. You will need to create an ExtensionRegistry
instance, add the extensions that you want to access, and then pass it to
mergeFrom/parseFrom. Otherwise, the extensions will just get treated as an
unknown field.

On Thu, Sep 30, 2010 at 9:21 AM, Squid <drbix...@gmail.com> wrote:

> So I have a message in one file, and in another file, I have a message
> with extends.  For example:
>
> file1.proto:
>
> message baseMessage {
>  required int32 test = 1;
>  extensions 1000 to max;
> }
>
> file2.proto
> extend baseMessage {
>  required int32 test2 = 1000;
> }
>
> My client then does something along the lines of:
> builder.setExtenssion (File2.test2, 12345);
>
> When my server gets the call that uses this message, I see the data
> being displayed correctly for both test1 and test2 in my log file
> including the extension number of 1000.  However, I cannot get the
> value of test2 and:
> request.hasExtension(File2.test2) == FALSE
>
> For some reason, protobuf doesn't seem to think that the extensions
> are there though I can see them coming through.
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@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 proto...@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