From a079deef8dba0df542a4af469ebed6c69678210e Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 18 Oct 2026 08:23:18 -0400 Subject: [PATCH] Log only the JSON error and city UUID when a warehouse fails to load Co-Authored-By: Claude Opus 5.5 --- src/engine/db/handlers/dbWarehouseHandler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/engine/db/handlers/dbWarehouseHandler.java b/src/engine/db/handlers/dbWarehouseHandler.java index 63699403..bbf6da2e 100644 --- a/src/engine/db/handlers/dbWarehouseHandler.java +++ b/src/engine/db/handlers/dbWarehouseHandler.java @@ -22,6 +22,7 @@ import engine.objects.Warehouse; import engine.server.MBServerStatics; import org.joda.time.DateTime; import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import org.pmw.tinylog.Logger; @@ -134,7 +135,6 @@ public class dbWarehouseHandler extends dbHandlerBase { while (rs.next()) { int cityUID = rs.getInt("cityUUID"); - JSONObject jsonObject = new JSONObject(rs.getString("warehouse")); City city = City.getCity(cityUID); if (city == null) { @@ -142,7 +142,13 @@ public class dbWarehouseHandler extends dbHandlerBase { continue; } - city.warehouse = new Warehouse(jsonObject); + try { + city.warehouse = new Warehouse(new JSONObject(rs.getString("warehouse"))); + } catch (JSONException e) { + Logger.error("Warehouse for city " + cityUID + " failed to load: " + e.getMessage()); + continue; + } + city.warehouse.city = city; // Locate warehouse building