Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid: "blockingToByteString is a blocking and unsafe operation"

In my Play Project I want to get the Message Digest of a File that I get from a REST Service.

Service call:

ws.url("deployment/data/idResource").withMethod("GET").stream

From the Response (WSResponse) I extract the body like:

response.bodyAsBytes.toByteBuffer.array()

This gives me this warning:

p.a.l.w.a.StandaloneAhcWSClient$ - blockingToByteString is a blocking and unsafe operation!

Is there a way to avoid this warning.

As mentioned in the end I need an Array[Byte] for the Message Digest.

like image 395
pme Avatar asked Oct 27 '25 08:10

pme


1 Answers

It might be a little bit late but I had the same problem and there was no answer, so here it is:

call execute instead of stream like

ws.url("deployment/data/idResource").withMethod("GET").execute

Then you can read WSResponse as json / string etc. without blocking warning

like image 93
cuZzior Avatar answered Oct 29 '25 05:10

cuZzior



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!