AlexeyMeshkov / protobuf-actionscript3

Automatically exported from code.google.com/p/protobuf-actionscript3
0 stars 0 forks source link

Decoding fails for repeated message field #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The as3 code (protobuf-actionscript3-2.3) fails to decode the following message 
(encoded with v2.2 C++version):

option optimize_for=SPEED;
message SNMPTrap {

    required fixed32 time = 1;
    required string oid = 2;
    required int32 version = 3;
    message SNMPVariable {
        required string oid = 1;
        required int32 type = 2;
        optional string     oid_value = 3;
        optional bytes      oct_string_value = 4;
        optional fixed32    int_value = 5;
    }
    repeated SNMPVariable variables = 10;

}

It fails with InvalidProtocolBufferException.invalidWireType, originating from 
line 99 in 
CodedInputStream.  

When stepping through the loop in "readFromCodedStream" it seems that when the 
first 
occurence of "SNMPVariable" is encountered, it fails to recognize that it is a 
repeated field 
and treats SNMPVariable field 1 as  SNMPTrap field 1 (time).

Please let me know if more information is needed

Original issue reported on code.google.com by kal...@gmail.com on 16 Dec 2009 at 8:28

GoogleCodeExporter commented 9 years ago
I should add that the first fields (time, oid, version) is decoded correctly 
before the 
exception throws.

Original comment by kal...@gmail.com on 16 Dec 2009 at 9:06

GoogleCodeExporter commented 9 years ago
I should also add that I've tested trunk too, without success.

Original comment by kal...@gmail.com on 16 Dec 2009 at 9:08

GoogleCodeExporter commented 9 years ago
Ok, after careful examination of the sent data was out of date. After some 
embarrassment ( and 5 hours of debugging), I can now conclude that this ticket 
can be 
closed :) 

Original comment by kal...@gmail.com on 16 Dec 2009 at 1:22

GoogleCodeExporter commented 9 years ago
I'm glad it works :) And sorry to hear about the debugging time... diving in 
those
bytebuffers can be really exhausting.

Original comment by sorrydevil@gmail.com on 19 Dec 2009 at 9:18