Markwon
Markwon copied to clipboard
NetworkSchemeHandler.handle() throws java.lang.IllegalStateException: Exception obtaining network resource
Markwon version: 4.6.2
Here is a problem that don't break my company's app, but is visible in AndroidStudio's Logcat.
Description
In my company's app there is a TextView
displaying some content which may be MarkDown.
We use the markwon.setMarkdown(mTextView, markDownContent);
to to display/handle the content in MarkDown.
The input for this case is:
Some text that is irrelevant and is not the problem
![Happy]
[Happy]: https://some-url-to-an-image-on-the-companys-domain.png ("Some logo")
For some reason there is an IllegalStateException
throw from your NetworkSchemeHandler.hanlde()
method when using this content.
This exception is caught in your library somewhere and luckily don't break our app.
The crash is then logged in AndroidStudio's Logcat.
The exception is only thrown when the MarkDown contains the URL to my company's image.
But... both the text and image is correctly displayed in the TextView even if the exception is thrown.
Exception
2022-06-07 11:50:03.684 1822-5825/? E/MARKWON-IMAGE: Error loading image: https://some-url-to-an-image-on-the-companys-domain.png
java.lang.IllegalStateException: Exception obtaining network resource: https://some-url-to-an-image-on-the-companys-domain.png
at o9.a.a(NetworkSchemeHandler.java:9)
at k9.d$a.run(AsyncDrawableLoaderImpl.java:6)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.io.InterruptedIOException: thread interrupted
at com.android.okhttp.okio.Timeout.throwIfReached(Timeout.java:147)
at com.android.okhttp.okio.Okio$1.write(Okio.java:75)
at com.android.okhttp.okio.AsyncTimeout$1.write(AsyncTimeout.java:157)
at com.android.okhttp.okio.RealBufferedSink.flush(RealBufferedSink.java:222)
at com.android.okhttp.internal.http.Http1xStream.finishRequest(Http1xStream.java:163)
at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:748)
at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:622)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:475)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:106)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:30)
at o9.a.a(NetworkSchemeHandler.java:4)
at k9.d$a.run(AsyncDrawableLoaderImpl.java:6)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Findings
- If I change the image's URL to: [A Google logo] (https://www.google.com/images/errors/logo_sm.gif) there is no exception thrown.
- When I browse to my company's image with the exact same URL, in a web browser, there is no delay whatsoever to display the image.
Conclusion
- Reading the exception hint's there some problem for Markwon to acquire the image. IO or async timeout problem.
- Even if the image is stored on my company's domain I don't think there is a huge delay reading the image.
Questions
- Is there a solution for this in Markwon? Increased timeout? Or:
- Can the log in Logcat be supressed?
Best regards Stefan Eriksson