Hi Vishal,

The message basically means that the protobuf is corrupted (or isn't a 
protobuf at all).

The message is giving you more detail on the specific kind of data 
corruption. Protocol buffers don't allow tag number 0 -- you can't define a 
field like "int32 a = 0". But the binary protobuf you tried to parse 
contained a tag with field number zero. So parsing the protobuf failed.

Josh

On Friday, February 5, 2016 at 1:38:03 PM UTC-8, Vishal Singh wrote:
>
> Hi,
>
> I am building an application using Sitewhere in which the message exchange 
> between device and the server is done using Protocol Buffer format. The 
> server sends a command to the device after converting the message in this 
> format, but at the device end when the bytes array is converted to get the 
> command, following exception is thrown:
>
>  com.google.protobuf.InvalidProtocolBufferException: Protocol message 
> contained an invalid tag (zero).
>      at 
> com.google.protobuf.CodedInputStream.readTag(CodedInputStream.java:108)
>      at 
> com.sitewhere.android.generated.Android$AndroidSpecification$_Header.<init>(Android.java:212)
>      at 
> com.sitewhere.android.generated.Android$AndroidSpecification$_Header.<init>(Android.java:203)
>      at 
> com.sitewhere.android.generated.Android$AndroidSpecification$_Header$1.parsePartialFrom(Android.java:255)
>      at 
> com.sitewhere.android.generated.Android$AndroidSpecification$_Header$1.parsePartialFrom(Android.java:1)
>      at 
> com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:200)
>      at 
> com.google.protobuf.AbstractParser.parsePartialDelimitedFrom(AbstractParser.java:241)
>      at 
> com.google.protobuf.AbstractParser.parseDelimitedFrom(AbstractParser.java:253)
>      at 
> com.google.protobuf.AbstractParser.parseDelimitedFrom(AbstractParser.java:259)
>      at 
> com.google.protobuf.AbstractParser.parseDelimitedFrom(AbstractParser.java:49)
>      at 
> com.sitewhere.android.generated.Android$AndroidSpecification$_Header.parseDelimitedFrom(Android.java:410)
>      at 
> com.sitewhere.android.example.SiteWhereExample.onReceivedCustomCommand(SiteWhereExample.java:273)
>      at 
> com.sitewhere.android.SiteWhereActivity$SiteWhereResponseProcessor.receivedCustomCommand(SiteWhereActivity.java:231)
>      at 
> com.sitewhere.android.mqtt.RegistrationManager.onCustomCommandReceived(RegistrationManager.java:112)
>      at 
> com.sitewhere.android.mqtt.DefaultMqttInteractionManager$MqttMessageProcessor.run(DefaultMqttInteractionManager.java:139)
>      at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
>      at java.util.concurrent.FutureTask.run(FutureTask.java:234)
>      at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
>
> I have no clue what is the meaning of "Protocol message contained an 
> invalid tag (zero)". Please help. The byte array received from the server 
> is: 
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to