From fcc136e2eb896612e48fcada384092857c734e8c Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 22 Jun 2023 15:01:47 -0400 Subject: [PATCH] v2.1.3: adjusted error logging in a few places --- .../src/main/java/com/watabou/noosa/RenderedText.java | 9 ++++++++- SPD-classes/src/main/java/com/watabou/utils/Bundle.java | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/SPD-classes/src/main/java/com/watabou/noosa/RenderedText.java b/SPD-classes/src/main/java/com/watabou/noosa/RenderedText.java index 3780b1f05..f827e4de0 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/RenderedText.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/RenderedText.java @@ -35,6 +35,7 @@ import com.watabou.glwrap.Quad; import java.nio.Buffer; import java.nio.FloatBuffer; +import java.util.ArrayList; import java.util.HashMap; public class RenderedText extends Image { @@ -73,6 +74,8 @@ public class RenderedText extends Image { this.size = size; measure(); } + + private static final ArrayList alreadyReported = new ArrayList<>(); private synchronized void measure(){ @@ -101,7 +104,11 @@ public class RenderedText extends Image { if (toException.length() > 30){ toException = toException.substring(0, 30) + "..."; } - Game.reportException(new Throwable("font file " + font.toString() + " could not render " + c + " from string: " + toException)); + //reduces logspam + if (!alreadyReported.contains(c)) { + Game.reportException(new Throwable("font file " + font.toString() + " could not render " + c + " from string: " + toException)); + alreadyReported.add(c); + } } } diff --git a/SPD-classes/src/main/java/com/watabou/utils/Bundle.java b/SPD-classes/src/main/java/com/watabou/utils/Bundle.java index cc7c611b0..36ecb4953 100644 --- a/SPD-classes/src/main/java/com/watabou/utils/Bundle.java +++ b/SPD-classes/src/main/java/com/watabou/utils/Bundle.java @@ -525,6 +525,7 @@ public class Bundle { // Some of these are written in a 'minified' format, some have duplicate keys. // We read them in with the libGDX JSON code, fix duplicates, write as full JSON // and then try to read again with org.json + Game.reportException(e); JsonValue gdxJSON = new JsonReader().parse(jsonString); killDuplicateKeysInLibGDXJSON(gdxJSON); json = new JSONTokener(gdxJSON.prettyPrint(JsonWriter.OutputType.json, 0)).nextValue();