You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When one creates an OkHttpNetworkAdaptor without specifying their own working OkHttpClient, the default OkHttpClient generated may have a null ProxySelector.
This causes a NullPointerException in my program using JRAW.
I discovered that ProxySelector.getDefault() returns null for Linux machines, so to circumvient the error I created an OkHttpNetworkAdaptor with a custom OkHttpClient, which has a custom ProxySelector which simply doesn't use a proxy (see https://github.com/square/okhttp/pull/4237/files, the NullProxySelector which was added).
OkHttp has been updated to implement such a NullProxySelector. Please update OkHttp, or implement the above change in https://github.com/mattbdean/JRAW/blob/master/lib/src/main/kotlin/net/dean/jraw/http/OkHttpNetworkAdapter.kt, specifically the line private val http: OkHttpClient = OkHttpClient() - you must use the OkHttpClient.Builder class and provide the ProxySelector. Such ProxySelector should either be ProxySelector.getDefault(), however if null, the proposed NullProxySelector.
I'd make a PR but this can simply be resolved by updating OkHttp.
Cheers,
omarathon
The text was updated successfully, but these errors were encountered:
When one creates an OkHttpNetworkAdaptor without specifying their own working OkHttpClient, the default OkHttpClient generated may have a null ProxySelector.
This causes a NullPointerException in my program using JRAW.
I discovered that
ProxySelector.getDefault()
returns null for Linux machines, so to circumvient the error I created an OkHttpNetworkAdaptor with a custom OkHttpClient, which has a custom ProxySelector which simply doesn't use a proxy (see https://github.com/square/okhttp/pull/4237/files, the NullProxySelector which was added).OkHttp has been updated to implement such a NullProxySelector. Please update OkHttp, or implement the above change in https://github.com/mattbdean/JRAW/blob/master/lib/src/main/kotlin/net/dean/jraw/http/OkHttpNetworkAdapter.kt, specifically the line
private val http: OkHttpClient = OkHttpClient()
- you must use the OkHttpClient.Builder class and provide the ProxySelector. Such ProxySelector should either beProxySelector.getDefault()
, however if null, the proposed NullProxySelector.I'd make a PR but this can simply be resolved by updating OkHttp.
Cheers,
omarathon
The text was updated successfully, but these errors were encountered: