badreads
badreads copied to clipboard
Crash while importing CSV file
Describe the bug:
App crashed while importing goodreads books in .csv
file format.
Steps to produce:
- Click on top right cornor 3 dot icon
- Library export/import > Import from CSV
- Choose your.
.csv
file App crashed
Crash logs:
FATAL EXCEPTION: main
Process: com.timenotclocks.bookcase, PID: 12400
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=20, result=-1, data=Intent { dat=content://com.android.providers.downloads.documents/document/720 flg=0x1 }} to activity {com.timenotclocks.bookcase/com.timenotclocks.bookcase.MainActivity}: com.github.doyaaaaaken.kotlincsv.util.CSVFieldNumDifferentException: Fields num seems to be 18 on each row, but on 1th csv row, fields num is 1.
at android.app.ActivityThread.deliverResults(ActivityThread.java:4271)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4315)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1647)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6518)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: com.github.doyaaaaaken.kotlincsv.util.CSVFieldNumDifferentException: Fields num seems to be 18 on each row, but on 1th csv row, fields num is 1.
at com.github.doyaaaaaken.kotlincsv.client.CsvFileReader$readAllAsSequence$2.invoke(CsvFileReader.kt:52)
at com.github.doyaaaaaken.kotlincsv.client.CsvFileReader$readAllAsSequence$2.invoke(CsvFileReader.kt:16)
at kotlin.sequences.TransformingIndexedSequence$iterator$1.next(Sequences.kt:234)
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170)
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786)
at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:816)
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:807)
at com.github.doyaaaaaken.kotlincsv.client.CsvReader$readAllWithHeader$3.invoke(CsvReader.kt:78)
at com.github.doyaaaaaken.kotlincsv.client.CsvReader$readAllWithHeader$3.invoke(CsvReader.kt:15)
at com.github.doyaaaaaken.kotlincsv.client.CsvReader.open(CsvReader.kt:178)
at com.github.doyaaaaaken.kotlincsv.client.CsvReader.readAllWithHeader(CsvReader.kt:78)
at com.timenotclocks.bookcase.api.GoodReadImport.serialize(GoodReadImport.kt:16)
at com.timenotclocks.bookcase.MainActivity.onActivityResult(MainActivity.kt:272)
at android.app.Activity.dispatchActivityResult(Activity.java:7290)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4267)
... 9 more
Device details: App version: 0.1.9 (19) [F-Droid] Android version: 8.1.0 Model: Lenovo Tab4 8 plus (TB-8704X)
Oh no! This looks like a bug... I realize you might not want to share the contents of the CSV. But maybe you could provide the first two lines? It looks like the error is raised there. Or otherwise maybe you could provide a csv example which reproduces this? I can also try exporting a good reads library myself and see if it can reproduce it
Same problem here, with a .csv file generated by the app:
- Click on top right corner 3 dot icon
- Library export/import > Export to CSV
- Delete all data
- Library export/import > Import from CSV
- Choose .csv file App crashed
Device: BlackBerry KeyOne OS: Android 8.1.0
Yes! So when exporting that data from the app sometimes the CSV will have an empty first row. If you manually fix the exported csv, remove the empty first row, it ought to import when trying again.
Also same problem here, with a .csv file generated by the app as a backup.
- Empty library
- Click on top right corner 3 dot icon
- Library export/import > Import from CSV
- Choose .csv file
- App crashed
Device: Pixel 6 Pro OS: Calyxos 3.5.1 (Android 12)
Checked the .csv file and it did not have an empty first row
interesting case thank you, I'll have to look into that (empty exports)