Java 协议消息端组标签与预期标签不匹配
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22105477/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Protocol message end-group tag did not match expected tag
提问by Mike Rylander
I keep getting the following stack trace and am not sure what it means.
我不断收到以下堆栈跟踪,但不确定这意味着什么。
Caused by: com.google.protobuf.InvalidProtocolBufferException: Protocol message end-group tag did not match expected tag.
at com.google.protobuf.InvalidProtocolBufferException.invalidEndTag(InvalidProtocolBufferException.java:73)
at com.google.protobuf.CodedInputStream.checkLastTagWas(CodedInputStream.java:124)
at com.google.protobuf.AbstractMessageLite$Builder.mergeFrom(AbstractMessageLite.java:189)
at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:732)
at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:238)
at com.google.protobuf.AbstractMessageLite$Builder.mergeFrom(AbstractMessageLite.java:178)
at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:724)
- What does "Protocol message end-group tag did not match expected tag." mean?
- What is a "message end-group tag"?
- Is this documented somewhere?
- “协议消息端组标记与预期标记不匹配”是什么意思。意思?
- 什么是“消息端组标签”?
- 这是在某处记录的吗?
采纳答案by Marc Gravell
Groups in protobuf are written as a start/end numeric pair - kinda like how <foo>
needs a </foo>
, but in a different format. Essentially it is complaining that it found a </bar>
instead (just: the xml is only a metaphor). The details are in the encoding specification, but the long and short is that one of:
protobuf 中的组写为开始/结束数字对 - 有点像 how<foo>
需要 a </foo>
,但格式不同。本质上,它抱怨它找到了一个</bar>
(只是:xml 只是一个比喻)。详细信息在编码规范中,但长短是其中之一:
- the data is inherently corrupt (either by damage of by a faulty encoder), or
- the data is becoming corrupt while reading, or
- the data is fine and you gave a faulty decoder
- 数据本质上已损坏(由有故障的编码器损坏),或
- 读取时数据损坏,或
- 数据很好,你给了一个错误的解码器
If I had to guess, the data has been damaged in transit - because that is so frighteningly common
如果我不得不猜测,数据在传输过程中已损坏 - 因为这太常见了