readium / SDKLauncher-Android

Launcher app for Readium SDK on Android
BSD 3-Clause "New" or "Revised" License
77 stars 65 forks source link

Crash on ePub3 lib - missing authors #72

Open nikolay-atanasov opened 8 years ago

nikolay-atanasov commented 8 years ago

The ePub3 lib caches if I tried to open a book with sample application and the book does not have authors

danielweck commented 8 years ago

First of all, crashing is not good. The ReadiumSDK C++ library includes a "error handler" API, and each native launcher app (iOS, OSX, Android) contains the necessary plumbing to notify EPUB parsing problems via the GUI (e.g. popup dialog).

So, assuming that by "authors" you mean dc:creator, dc:contributor or dc:publisher, then this metadata is optional so your EPUB should be valid. http://www.idpf.org/epub/301/spec/epub-publications.html#sec-opf-dcmes-optional By the way, is your ebook EPUB2 or EPUB3?

Are you able / allowed to share the ebook so we can run some tests at our end? Thanks!

nikolay-atanasov commented 8 years ago

Hello,

When I try to open this book (http://www.imeon-soft.com/Users_Guide.epub) with SDKLauncher-Android, the fatal error occurs and Android kills the application. Here, I copy the output from LogCat

10-02 14:41:22.838: A/libc(13479): !@Fatal signal 11, thread 13479 10-02 14:41:22.838: A/libc(13479): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 13479 (ndroid.launcher)

This book has been created with old version of calibre. I have tried to create a new book with missing author('s) filed but the latest version of calibre manages this field properly and SDKLauncher does not crashes.

How can I use "error handler" API to avoid such crashes? Is there any example snipped in the SDKLauncher-Android

TienHai commented 8 years ago

@nikolay-atanasov Hello,

I get your epub file example. First your epub is not epubcheck, tags "dc:title" and "dc:language" are missing. But you are right Readium should not crash.

@danielweck Hello,

Readium seems to crash when it calls method "EPub3.openBook", this method calls jni method in file "readium-sdk/Platform/Android/jni/epub3.cpp", and the method seems to crash at line 455. But we have some warnings before crash, due to missing tags in metadata of ePub file, it seems to come from the method "LauncherErrorHandler" line 222 of the same file.

If we replace line 235 => return (bool)b; in "LauncherErrorHandler" method by => return !isSevereEpubError;

Readium don't crash, and in "SDKLauncher-Android" we see alert dialog created in "popSdkErrorHandlerMessage" method in file "ContainerList.java" when we open the book.

danielweck commented 8 years ago

@TienHai thank you for your investigation. Any EPUB3 parsing error (including the ones marked as "severe" in the Readium SDK) should be processed by the error handler, giving the user some feedback, and providing an option to ignoring errors or cancelling the ebook loading process. We will look into this. Crashing behaviour is ; without any doubt ; a bug.

However, please bear in mind that at this stage, the "application launchers" are barebones pieces of software that are not production-ready, they are not designed for a polished user experience. They demonstrate how to integrate the Readium SDK at its most basic level. So please do not expect a completely smooth, off-the-shelf commercial-grade product. Feel free to propose improvements too (pull requests are welcome).

rkwright commented 8 years ago

Marking critical both because of the crash and because we are weak in general with respect to handling "bad" content.

danielweck commented 6 years ago

Related issue: https://github.com/readium/SDKLauncher-Android/issues/137