evansloan / collection-log

A Runelite plugin that adds visual improvements to the collection log
BSD 2-Clause "Simplified" License
15 stars 11 forks source link

Getting JsonSyntaxException on game state change #5

Closed Nightfirecat closed 4 years ago

Nightfirecat commented 4 years ago
[Client] WARN net.runelite.client.eventbus.EventBus - Uncaught exception in event subscriber
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was NUMBER at line 1 column 11 path $.
    at com.google.gson.Gson.fromJson(Gson.java:939)
    at com.google.gson.Gson.fromJson(Gson.java:892)
    at com.google.gson.Gson.fromJson(Gson.java:841)
    at com.evansloan.collectionlog.CollectionLogPlugin.loadItems(CollectionLogPlugin.java:384)
    at com.evansloan.collectionlog.CollectionLogPlugin.onGameStateChanged(CollectionLogPlugin.java:138)
    at net.runelite.client.eventbus.EventBus$Subscriber.invoke(EventBus.java:73)
    at net.runelite.client.eventbus.EventBus.post(EventBus.java:222)
    at net.runelite.client.callback.Hooks.post(Hooks.java:165)
    at client.ys(client.java:61392)
    at ft.ez(ft.java:1311)
    at client.ar(client.java:1183)
    at bw.u(bw.java:334)
    at bw.run(bw.java:313)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was NUMBER at line 1 column 11 path $.
    at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
    at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:187)
    at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)
    at com.google.gson.Gson.fromJson(Gson.java:927)
    ... 13 more
evansloan commented 4 years ago

Does this happen regularly? I can't seem to replicate it on my end. The only thing I can think of is that maybe it's trying to load some old config values? The old obtained items config used to be stored as Map<String, Integer> instead of Map<String, CollectionLogItem[]>.

Nightfirecat commented 4 years ago

Looks like it, I've got these entries for collection log progress in my config:

collectionlog.my@login.com.obtained_items={"total"\:8,"Abyssal Sire"\:6,"Vorkath"\:2}
collectionlog.my@login.com.obtained_counts={"total"\:424,"Abyssal Sire"\:5,"Alchemical Hydra"\:2,"Barrows Chests"\:1,"Cerberus"\:1,"Commander Zilyana"\:1,"Dagannoth Kings"\:6,"The Fight Caves"\:1,"General Graardor"\:2,"Giant Mole"\:2,"Grotesque Guardians"\:6,"Hespori"\:4,"The Inferno"\:1,"Kalphite Queen"\:2,"King Black Dragon"\:1,"Kraken"\:2,"Kree\\u0027arra"\:1,"K\\u0027ril Tsutsaroth"\:1,"Skotizo"\:3,"Thermonuclear Smoke Devil"\:3,"Vorkath"\:2,"Wintertodt"\:7,"Beginner Treasure Trails"\:7,"Easy Treasure Trails"\:27,"Medium Treasure Trails"\:24,"Hard Treasure Trails"\:68,"Elite Treasure Trails"\:9,"Master Treasure Trails"\:3,"Shared Treasure Trail Rewards"\:48,"Barbarian Assault"\:1,"Fishing Trawler"\:4,"Hallowed Sepulchre"\:15,"Magic Training Arena"\:1,"Pest Control"\:8,"Rogues\\u0027 Den"\:5,"Temple Trekking"\:4,"Tithe Farm"\:6,"Trouble Brewing"\:1,"Aerial Fishing"\:4,"All Pets"\:8,"Champion\\u0027s Challenge"\:1,"Chompy Bird Hunting"\:2,"Cyclopes"\:8,"Glough\\u0027s Experiments"\:6,"Motherlode Mine"\:6,"Random Events"\:17,"Revenants"\:3,"Rooftop Agility"\:6,"Shayzien Armour"\:25,"Skilling Pets"\:3,"Slayer"\:26,"Miscellaneous"\:24}
collectionlog.my@login.com.completed_categories=["Hespori","Fishing Trawler","Rogues\\u0027 Den","Temple Trekking","Cyclopes","Glough\\u0027s Experiments","Motherlode Mine","Rooftop Agility","Shayzien Armour"]
evansloan commented 4 years ago

I set my obtained items config to what yours was set to. I did get the error on log in, but after clicking through the collection log and logging in again, the config was set to the new config and the error was gone. If you go through the collection log again is it not overwriting the old config?

Nightfirecat commented 4 years ago

I haven't actually clicked through the collection log at all since seeing these errors. Is that what you'd recommend for resolving this?

evansloan commented 4 years ago

Yeah that should fix it. It seems the error is only happening if the old config format is still saved from an older version of the plugin.