Hi,
        The following simple example throws an exception when I 'read'
which I think is caused by my bad code. What is missing here ?

Thanks.

InvalidProtocolBufferExceptionProtocol message contained an invalid
tag (zero).
com.google.protobuf.InvalidProtocolBufferException: Protocol message
contained an invalid tag (zero).
        at
com.google.protobuf.InvalidProtocolBufferException.invalidTag(InvalidProtocolBufferException.java:
68)
        at com.google.protobuf.CodedInputStream.readTag(CodedInputStream.java:
108)

------------------------------------------------------------

package message;

message Load {

  enum LoadType {
    HIGH = 0;
    MEDIUM = 1;
    LOW = 2;
  }
  message LoadBalance {
    optional LoadType type = 2 [default = MEDIUM];
  }
  optional LoadBalance loadbalancer = 1;
}

------------------------------------------------------------
Write------------------------------------------------------------


        Message.Load message =
Message.Load.newBuilder().setLoadbalancer(
 
Message.Load.LoadBalance.newBuilder().setType( 
Message.Load.LoadType.HIGH)).build();
        System.out.println( "Distributed value is " +
message.getAllFields() );
        return message.toByteArray(); // write somewhere

------------------------------------------------------------
Read------------------------------------------------------------


            Message.Load message = Message.Load.parseFrom( value );

-- 
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