The change you requested should be in the last Java build - 226.0.0 which has just been released.
There is also a test on response.body (just in case).
Let us know if that clears the alert.
Original Message:
Sent: 05-23-2025 20:04
From: Gaël BLAISE
Subject: OkHttpResponse class should close the underlying OkHttp's response
Hello Jerome,
I beg you pardon, you are right the null checks on the response and its body seems to be a good idea.
In our case, as we don't make API calls without body I didn't take this in account, but I did effectively checked that the response does exist before trying to close it.
Sorry, I totally forgot to mention it in my first post.
------------------------------
Gaël BLAISE
National Bank of Canada
Original Message:
Sent: 05-21-2025 13:23
From: Jerome Saint-Marc
Subject: OkHttpResponse class should close the underlying OkHttp's response
Hello,
I have some issues reproducing this.
Could you please try with this code as well if you don't mind, and see if it also makes the alert disappear?
@Override
public void close() throws Exception {
if (response != null && response.body() != null) {
response.close();
}
}
Thank you.
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
Original Message:
Sent: 05-15-2025 15:50
From: Gaël BLAISE
Subject: OkHttpResponse class should close the underlying OkHttp's response
In OkHttpResponse#close method (Github link), you do nothing there. But in fact, the response object, which is an OkHttp's Reponse should be closed, as it implements the AutoClosable interface of Java.
We had this message regulary before :
A connection to [Genesys cloud URL here] was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
We did not reproduced it on demand, but it was due to the fact that the response is not closed on the SDK side.
The very moment we used reflection (in our code) to forcefully close the response when the SDK's OkHttpResponse#closemethod is called, the alert was no more seen.
So could you update the SDK's code of this class to transform @Override public void close() throws Exception { }into @Override public void close() throws Exception { response.close(); } please?
#PlatformSDK
------------------------------
Gaël BLAISE
National Bank of Canada
------------------------------