kotlin-toolkit icon indicating copy to clipboard operation
kotlin-toolkit copied to clipboard

Exceptions thrown and completion not called, when calling `EpubNavigatorFragment::go`.

Open jerome65536 opened this issue 4 years ago • 1 comments

To reproduce:

  • Run the app in Android Studio to see the debug logs.
  • Open a book.
  • Tap near the top of the screen to open the top bar.
  • Press the ≡ button.
  • Click on a random chapter (this calls go).
  • Check the logs, scroll some way up and see some exceptions.
--- a/r2-navigator/src/main/java/org/readium/r2/navigator/epub/EpubNavigatorFragment.kt
+++ b/r2-navigator/src/main/java/org/readium/r2/navigator/epub/EpubNavigatorFragment.kt
     override fun go(locator: Locator, animated: Boolean, completion: () -> Unit): Boolean {
+        Log.d("***", "GO -> $locator")
D/***: GO -> Locator(href=/OPS/main4.xml, type=, title=Chapter 5, locations=Locations(fragments=[], progression=0.0, position=null, totalProgression=null, otherLocations={}), text=Text(before=null, highlight=null, after=null))
D/R2BasicWebView: runJavaScript: setScrollMode(true)
D/R2BasicWebView: runJavaScript: setScrollMode(true)
V/PublicationResourceHandler$get: Method: GET, Uri: /2ea13a85628fca53af8a113fb815fb6e/OPS/cover.xml
V/PublicationResourceHandler$get: Method: GET, Uri: /2ea13a85628fca53af8a113fb815fb6e/OPS/title.xml
D/R2BasicWebView: runJavaScript: setScrollMode(true)
D/R2BasicWebView: runJavaScript: setScrollMode(true)
D/R2BasicWebView: runJavaScript: setScrollMode(true)
W/cr_AwContents: Application attempted to call on a destroyed WebView
    java.lang.Throwable
        at org.chromium.android_webview.AwContents.t(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2)
        at Mt.loadingStateChanged(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:335)
        at android.os.Looper.loop(Looper.java:183)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
W/cr_AwContents: Application attempted to call on a destroyed WebView
    java.lang.Throwable
        at org.chromium.android_webview.AwContents.t(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2)
        at Mt.loadingStateChanged(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:335)
        at android.os.Looper.loop(Looper.java:183)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
V/PublicationResourceHandler$get: Method: GET, Uri: /2ea13a85628fca53af8a113fb815fb6e/OPS/main4.xml
V/PublicationResourceHandler$get: Method: GET, Uri: /2ea13a85628fca53af8a113fb815fb6e/OPS/main3.xml
V/PublicationResourceHandler$get: Method: GET, Uri: /2ea13a85628fca53af8a113fb815fb6e/OPS/main5.xml
V/BaseHandler: Method: GET, URL: /assets/readium-css/ReadiumCSS-after.css
V/BaseHandler: Method: GET, URL: /assets/readium-css/ReadiumCSS-before.css
V/BaseHandler: Method: GET, URL: /assets/scripts/gestures.js
E/NanoHTTPD: Could not send response to the client
    java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:117)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:149)
        at org.nanohttpd.protocols.http.response.ChunkedOutputStream.write(ChunkedOutputStream.java:68)
        at org.nanohttpd.protocols.http.response.ChunkedOutputStream.write(ChunkedOutputStream.java:61)
        at java.util.zip.GZIPOutputStream.writeHeader(GZIPOutputStream.java:182)
        at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:94)
        at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:109)
        at org.nanohttpd.protocols.http.response.Response.sendBodyWithCorrectEncoding(Response.java:309)
        at org.nanohttpd.protocols.http.response.Response.sendBodyWithCorrectTransferAndEncoding(Response.java:300)
        at org.nanohttpd.protocols.http.response.Response.send(Response.java:268)
        at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:432)
        at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75)
        at java.lang.Thread.run(Thread.java:923)
E/NanoHTTPD: Could not send response to the client
    java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:117)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:149)
        at org.nanohttpd.protocols.http.response.ChunkedOutputStream.write(ChunkedOutputStream.java:68)
        at org.nanohttpd.protocols.http.response.Response.sendBody(Response.java:340)
        at org.nanohttpd.protocols.http.response.Response.sendBodyWithCorrectEncoding(Response.java:313)
        at org.nanohttpd.protocols.http.response.Response.sendBodyWithCorrectTransferAndEncoding(Response.java:300)
        at org.nanohttpd.protocols.http.response.Response.send(Response.java:268)
        at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:432)
        at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75)
        at java.lang.Thread.run(Thread.java:923)
E/NanoHTTPD: Could not send response to the client
    java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:117)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:149)
        at org.nanohttpd.protocols.http.response.ChunkedOutputStream.write(ChunkedOutputStream.java:68)
        at org.nanohttpd.protocols.http.response.ChunkedOutputStream.write(ChunkedOutputStream.java:61)
        at java.util.zip.GZIPOutputStream.writeHeader(GZIPOutputStream.java:182)
        at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:94)
        at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:109)
        at org.nanohttpd.protocols.http.response.Response.sendBodyWithCorrectEncoding(Response.java:309)
        at org.nanohttpd.protocols.http.response.Response.sendBodyWithCorrectTransferAndEncoding(Response.java:300)
        at org.nanohttpd.protocols.http.response.Response.send(Response.java:268)
        at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:432)
        at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75)
        at java.lang.Thread.run(Thread.java:923)

jerome65536 avatar May 20 '21 14:05 jerome65536

I think the exceptions are mostly warnings and unrelated to the completion closure not being called. It looks like the completion was not fully implemented because it is not used in the go() API.

mickael-menu avatar May 20 '21 14:05 mickael-menu