Log only the JSON error and city UUID when a warehouse fails to load

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-18 08:23:18 -04:00
1 parent 963130565e
commit a079deef8d
1 file changed
+8 -2
@@ -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