From e48e46b9233fb6167d7708f2b29857f648b63f58 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Thu, 16 May 2024 17:30:58 +0530 Subject: [PATCH] Fixed: application crashing when hosting the split zim files on server, since we have an issue with split zim files of `zim-tools`. Due to this issue, there is crash reported on the playStore. Because we have full access to files in the playStore variant since all the files are located in the `app-specific` directory. * Improved the log for showing the actual error if there is something goes wrong while adding the book in `Library`. --- .../kiwix/kiwixmobile/core/webserver/KiwixServer.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/webserver/KiwixServer.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/webserver/KiwixServer.kt index 16752e601..d54235ddd 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/webserver/KiwixServer.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/webserver/KiwixServer.kt @@ -23,7 +23,6 @@ import org.kiwix.kiwixmobile.core.utils.files.Log import org.kiwix.kiwixmobile.core.reader.ZimReaderContainer import org.kiwix.kiwixmobile.core.utils.files.FileUtils.getDemoFilePathForCustomApp import org.kiwix.libkiwix.Book -import org.kiwix.libkiwix.JNIKiwixException import org.kiwix.libkiwix.Library import org.kiwix.libkiwix.Server import org.kiwix.libzim.Archive @@ -67,8 +66,13 @@ class KiwixServer @Inject constructor( update(archive) } kiwixLibrary.addBook(book) - } catch (e: JNIKiwixException) { - Log.v(TAG, "Couldn't add book with path:{ $path }") + } catch (ignore: Exception) { + // Catch the other exceptions as well. e.g. while hosting the split zim files. + // we have an issue with split zim files, see #3827 + Log.v( + TAG, + "Couldn't add book with path:{ $path }.\n Original Exception = $ignore" + ) } } return KiwixServer(kiwixLibrary, Server(kiwixLibrary))