I asked at StackOverflow too and I fixed it:

https://stackoverflow.com/questions/55954550/failing-parsefrom-messages-in-java-from-c/55958665

Em quinta-feira, 2 de maio de 2019 11:36:21 UTC-3, [email protected] 
escreveu:
>
> Hello folks, I have a question/problem.
>
>
> I'm sending messages from C++ to Java (Play framework) using RabbitMq. So, 
> in C++ side I used SerializeToString function (also tried SerializeToArray
>  with char* ). ParseFrom doesn't work in Java using String or byte [].
>
>
> Detail: in my message, I send base64 images, over 500k characters as 
> String. 
>
>
> The error is: CodedInputStream encountered an embedded string or message 
> which claimed to have negative size.
>
>
> Messages without base64 strings and other attributes, ParseFrom works ok.
>
> Here the complete error:
>
> play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution 
> exception[[InvalidProtocolBufferException: CodedInputStream encountered an 
> embedded string or message which claimed to have negative size.]]
>     at 
> play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:323)
>     at 
> play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:243)
>     at 
> play.core.server.AkkaHttpServer$$anonfun$1.applyOrElse(AkkaHttpServer.scala:382)
>     at 
> play.core.server.AkkaHttpServer$$anonfun$1.applyOrElse(AkkaHttpServer.scala:380)
>     at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:417)
>     at 
> scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
>     at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
>     at 
> akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
>     at 
> akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
>     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
> Caused by: com.google.protobuf.InvalidProtocolBufferException: 
> CodedInputStream encountered an embedded string or message which claimed to 
> have negative size.
>     at 
> com.google.protobuf.InvalidProtocolBufferException.negativeSize(InvalidProtocolBufferException.java:92)
>     at 
> com.google.protobuf.CodedInputStream$ArrayDecoder.pushLimit(CodedInputStream.java:1179)
>     at 
> com.google.protobuf.CodedInputStream$ArrayDecoder.readMessage(CodedInputStream.java:881)
>     at 
> model.RequestOrResponse$Response.dynamicMethod(RequestOrResponse.java:1542)
>     at 
> com.google.protobuf.GeneratedMessageLite.parsePartialFrom(GeneratedMessageLite.java:1597)
>     at 
> com.google.protobuf.GeneratedMessageLite.parsePartialFrom(GeneratedMessageLite.java:1630)
>     at 
> com.google.protobuf.GeneratedMessageLite.parseFrom(GeneratedMessageLite.java:1746)
>     at model.RequestOrResponse$Response.parseFrom(RequestOrResponse.java:1232)
>     at controllers.SubjectController.get(SubjectController.java:189)
>     at 
> router.Routes$$anonfun$routes$1.$anonfun$applyOrElse$14(Routes.scala:187)
>
>
>

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