Re: [protobuf] Protobuf3 InvalidProtocolBufferException with some strings

2018-05-17 Thread Marc Gravell
(mainly for the list) see also the stackoverflow question:
https://stackoverflow.com/q/50387660/23354

On Thu, 17 May 2018 at 10:42, Alexey Vishnyakov 
wrote:

> Hello
>
> We using protobuf v.3 to transfer messages from C# client to Java server
> over HTTP.
>
> The message proto looks like this:
>
> message CLIENT_MESSAGE {
> string message = 1;
> }
>
> Both client and server uses UTF-8 character encoding for strings.
>
> Everything is fine whe we are using short string values like "abc", but
> when we trying to transfer string with 198 chars in it, we catchig an
> Exception:
>
>
>com.google.protobuf.InvalidProtocolBufferException:
> While parsing a protocol message, the input ended unexpectedly in the
> middle of a field. This could mean either that the input has been
> truncated or that an embedded message misreported its own length.
>
>
> We tried to compare even byte array containing protobuf data, and didn't
> found a solution.
> For "aaa" string byte array starts with this bytes:
>
> 10 3 97 97 97
>
>
> Where 10 is protobuf field number, and 3 is string length, 69 65 67 is
> "aaa".
>
> For string
>
>
>> "aa"
>
>
> which contains 198 characters in it, byte array starts with this:
>
> 10 198 1 97 97 97
>
>
> Where 10 is protobuf field number, and 198 is string length, and 1 seems
> to be like string identifier, or what?
>
>
> And why protobuf cannot parse this message?
>
> Already spent almost a day on looking for solution for this problem, any
> help appreciated.
>
> Thanks in advance.
>
> --
> 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 https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Regards,

Marc

-- 
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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Protobuf3 InvalidProtocolBufferException with some strings

2018-05-17 Thread Alexey Vishnyakov
Hello

We using protobuf v.3 to transfer messages from C# client to Java server 
over HTTP.

The message proto looks like this:

message CLIENT_MESSAGE {
string message = 1;
}

Both client and server uses UTF-8 character encoding for strings.

Everything is fine whe we are using short string values like "abc", but 
when we trying to transfer string with 198 chars in it, we catchig an 
Exception:

  
   com.google.protobuf.InvalidProtocolBufferException: 
While parsing a protocol message, the input ended unexpectedly in the 
middle of a field. This could mean either that the input has been truncated 
or that an embedded message misreported its own length.


We tried to compare even byte array containing protobuf data, and didn't 
found a solution.
For "aaa" string byte array starts with this bytes:

10 3 97 97 97


Where 10 is protobuf field number, and 3 is string length, 69 65 67 is 
"aaa".

For string 

"aa"

 
which contains 198 characters in it, byte array starts with this:

10 198 1 97 97 97


Where 10 is protobuf field number, and 198 is string length, and 1 seems to 
be like string identifier, or what?


And why protobuf cannot parse this message?

Already spent almost a day on looking for solution for this problem, any 
help appreciated.

Thanks in advance.

-- 
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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.