Helium314 / Local-NLP-Backend

Yet another network location backend for the UnifiedNLP/microG project
GNU General Public License v3.0
64 stars 4 forks source link

Cannot export data: No enum constant org.fitchfamily.android.dejavu.EmitterType #25

Closed ptrcnull closed 2 months ago

ptrcnull commented 2 months ago

version: 1.2.11 installed from: f-droid os: lineage microg 20 (2023-07-04)

full stacktrace from logcat:

04-22 13:41:06.603  5149  5165 I LocalNLP Settings: exportToFile - error
04-22 13:41:06.603  5149  5165 I LocalNLP Settings: java.lang.IllegalArgumentException: No enum constant org.fitchfamily.android.dejavu.EmitterType.
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at java.lang.Enum.valueOf(Enum.java:259)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at org.fitchfamily.android.dejavu.EmitterType.valueOf(RfCharacteristics.kt:0)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at org.fitchfamily.android.dejavu.DatabaseKt.toRfEmitter(Database.kt:489)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at org.fitchfamily.android.dejavu.DatabaseKt.toRfEmitter$default(Database.kt:486)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at org.fitchfamily.android.dejavu.Database$getAll$1.invoke(Database.kt:423)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at org.fitchfamily.android.dejavu.Database$getAll$1.invoke(Database.kt:423)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at org.fitchfamily.android.dejavu.DatabaseKt$toSequence$1.invoke(Database.kt:476)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlin.sequences.GeneratorSequence$iterator$1.calcNext(Sequences.kt:591)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlin.sequences.GeneratorSequence$iterator$1.hasNext(Sequences.kt:609)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at org.fitchfamily.android.dejavu.SettingsActivity$exportToFile$2.invokeSuspend(SettingsActivity.kt:1295)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
04-22 13:41:06.603  5149  5165 I LocalNLP Settings:     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Helium314 commented 2 months ago

Weird. Looks like you somehow got an not existing emitter type in the database. Did you modify anything using root access?

ptrcnull commented 2 months ago

nope, at most just imported some data from a .csv

Helium314 commented 2 months ago

Looks like you imported invalid data. For csv data in the format exported by LocalNlp there is no check done when importing, I think when omitting it I just assumed the imported data is data exported by LocalNlp.

ptrcnull commented 2 months ago

ah! i think i got it:

sqlite> .headers on
sqlite> select * from emitters limit 5;
rfID|rfType|latitude|longitude|radius_ns|radius_ew|note
||55.670509|12.576118|1000.0|1000.0|

not exactly sure how that happened, but i feel like that would be the emitter that's breaking exports

ptrcnull commented 2 months ago
sqlite> delete from emitters where rfType = '';
sqlite> select distinct rfType from emitters;
LTE
WLAN2
WLAN5

that did it, perhaps there could be some safeguard against importing invalid emitters, or filter on exporting whenever they cannot be serialized?

Helium314 commented 2 months ago

Yes, it should definitely be added in at least one of those places.