schierlm / BibleMultiConverter

Converter written in Java to convert between different Bible program formats
Other
124 stars 33 forks source link

MyBibleZone import fails if a chapter contains verse number 0 #23

Closed ickc closed 5 years ago

ickc commented 5 years ago

Hi, I encounters errors when I'm trying to convert resources from ph4.org in MyBibleZone format. The resources are in Chinese and I don't know if that might be the source of problems.

Steps to reproduce the bug:

# from https://www.ph4.org/b4_index.php, 聖經恢復本
# unzip and obtain CRV.SQLite3, CRV.commentaries.SQLite3
$ wget -qO- 'http://mybible.i-t.kz/mybible/CRV.zip' | bsdtar -xf-
$ java -jar BibleMultiConverter-AllInOneEdition.jar MyBibleZone CRV.SQLite3 LogosVersificationDetector
Exception in thread "main" java.lang.IllegalArgumentException: number is invalid: 0
    at biblemulticonverter.data.Utils.validateString(Utils.java:32)
    at biblemulticonverter.data.Verse.<init>(Verse.java:11)
    at biblemulticonverter.sqlite.format.MyBibleZone.doImport(MyBibleZone.java:284)
    at biblemulticonverter.Main.main(Main.java:66)
$ java -jar BibleMultiConverter-AllInOneEdition.jar MyBibleZone CRV.commentaries.SQLite3 LogosVersificationDetector
Exception in thread "main" org.tmatesoft.sqljet.core.SqlJetException: Table not found: verses: error code is ERROR
    at org.tmatesoft.sqljet.core.internal.table.SqlJetTable.<init>(SqlJetTable.java:63)
    at org.tmatesoft.sqljet.core.table.SqlJetDb$2.runWithLock(SqlJetDb.java:197)
    at org.tmatesoft.sqljet.core.table.SqlJetDb$1.runSynchronized(SqlJetDb.java:172)
    at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.runSynchronized(SqlJetEngine.java:217)
    at org.tmatesoft.sqljet.core.table.SqlJetDb.runWithLock(SqlJetDb.java:170)
    at org.tmatesoft.sqljet.core.table.SqlJetDb.getTable(SqlJetDb.java:195)
    at biblemulticonverter.sqlite.format.MyBibleZone.doImport(MyBibleZone.java:165)
    at biblemulticonverter.Main.main(Main.java:66)
schierlm commented 5 years ago

Thank you for the bug report.

Issue is caused by a verse number 0 that appears in one of the Psalms. But import should not fail on that one (maybe export to some formats later).

It is normal that you cannot import the .commentaries.SQLite3 file - it will automatically be loaded when importing the main file.

As a workaround (until this bug is fixed), you can open the CRV.SQLite3 in SQLite browser and run this SQL: UPDATE verses set verse=999 where verse=0

Then import into Diffable format (which you can edit in a text editor) and edit the psalms that contain verse 999 manually. Then convert from Diffable format to whatever format you desire

Note to myself: Importing this module creates quite a lot of warnings due to new tags introduced in MyBible 4.8. These should also be added to the importer. :)