mojira.dev
MC-298717

Unreadable JsonSyntaxException on corrupt banned-players.json

When the banned-ips.json or banned-players.json files of a dedicated server don’t contain a JSON array, but for example a JSON object (like {}), the error message on startup does not point the casual server owner towards the knowledge that these two files are the problem.

There should be information added which file has the problem to drastically decrease the time players have to search for the reason of the crash.

[10:37:08] [Server thread/ERROR]: Encountered an unexpected exception
com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray but was com.google.gson.JsonObject; at path $
	at com.google.gson.internal.bind.TypeAdapters$34$1.read(TypeAdapters.java:1152) ~[gson-2.11.0.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1361) ~[gson-2.11.0.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1262) ~[gson-2.11.0.jar:?]
	at com.google.gson.Gson.fromJson(Gson.java:1199) ~[gson-2.11.0.jar:?]
	at ayg.f(SourceFile:119) ~[server-1.21.8.jar:?]
	at arh.z(SourceFile:85) ~[server-1.21.8.jar:?]
	at arh.<init>(SourceFile:24) ~[server-1.21.8.jar:?]
	at ari.e(SourceFile:174) ~[server-1.21.8.jar:?]
	at net.minecraft.server.MinecraftServer.y(SourceFile:672) ~[server-1.21.8.jar:?]
	at net.minecraft.server.MinecraftServer.a(SourceFile:291) ~[server-1.21.8.jar:?]
	at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
[10:37:08] [Server thread/ERROR]: This crash report has been saved to [...]

Linked issues

Comments 0

No comments.

McModknower

(Unassigned)

Plausible

Platform

Normal

Crash, Dedicated Server

1.21.5, 1.21.6 Release Candidate 1, 1.21.8

Retrieved