my protocol file begin with...

option java_outer_classname = "Protocol";

message MyMessage
{
    required ID id = 1;
    optional .... // omitted
    ...
}

only one required field and all others are optional.

And my test code is...(just same)

Protocol.MyMessage.newBuilder().setId(Protocol.ID.MY_PROTOCOL).build().
toByteArray();

toByteArray() function make exception.
without it, it's okay

On Thursday, March 14, 2013 4:40:23 AM UTC+9, Feng Xiao wrote:
>
> Could you attach your test code and the .proto file?
>
>
> On Tue, Mar 12, 2013 at 11:42 PM, Hongseok Yoon 
> <hongse...@gmail.com<javascript:>
> > wrote:
>
>> I've just updated to 2.5.0 from 2.4.1.
>> before update, protobuf worked well, BUT not it vomit exceptions!
>> I'm working on OSX and use Java 1.7
>>
>> my test code snippet is...
>>
>> Protocol.MyMessage.newBuilder().setId(Protocol.ID.MY_PROTOCOL).build().
>> toByteArray();
>>
>> if I run compiled code...
>>
>> Exception in thread "main" java.lang.UnsupportedOperationException: This 
>> is supposed to be overridden by subclasses.
>> at 
>> com.google.protobuf.GeneratedMessage.getUnknownFields(GeneratedMessage.java:180)
>>  at 
>> com.indiebuild.poker.Protocol$PokerMessage.getSerializedSize(Protocol.java:1454)
>> at 
>> com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:62)
>>  at TestClient.main(TestClient.java:8)
>>
>> What's wrong?
>>
>> -- 
>> 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+u...@googlegroups.com <javascript:>.
>> To post to this group, send email to prot...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/protobuf?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to