v2.1.3: adjusted error logging in a few places

This commit is contained in:
Evan Debenham
2023-06-22 15:01:47 -04:00
parent beee1fadac
commit fcc136e2eb
2 changed files with 9 additions and 1 deletions
@@ -35,6 +35,7 @@ import com.watabou.glwrap.Quad;
import java.nio.Buffer; import java.nio.Buffer;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
public class RenderedText extends Image { public class RenderedText extends Image {
@@ -74,6 +75,8 @@ public class RenderedText extends Image {
measure(); measure();
} }
private static final ArrayList<Character> alreadyReported = new ArrayList<>();
private synchronized void measure(){ private synchronized void measure(){
if (Thread.currentThread().getName().equals("SHPD Actor Thread")){ if (Thread.currentThread().getName().equals("SHPD Actor Thread")){
@@ -101,7 +104,11 @@ public class RenderedText extends Image {
if (toException.length() > 30){ if (toException.length() > 30){
toException = toException.substring(0, 30) + "..."; toException = toException.substring(0, 30) + "...";
} }
//reduces logspam
if (!alreadyReported.contains(c)) {
Game.reportException(new Throwable("font file " + font.toString() + " could not render " + c + " from string: " + toException)); Game.reportException(new Throwable("font file " + font.toString() + " could not render " + c + " from string: " + toException));
alreadyReported.add(c);
}
} }
} }
@@ -525,6 +525,7 @@ public class Bundle {
// Some of these are written in a 'minified' format, some have duplicate keys. // 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 // We read them in with the libGDX JSON code, fix duplicates, write as full JSON
// and then try to read again with org.json // and then try to read again with org.json
Game.reportException(e);
JsonValue gdxJSON = new JsonReader().parse(jsonString); JsonValue gdxJSON = new JsonReader().parse(jsonString);
killDuplicateKeysInLibGDXJSON(gdxJSON); killDuplicateKeysInLibGDXJSON(gdxJSON);
json = new JSONTokener(gdxJSON.prettyPrint(JsonWriter.OutputType.json, 0)).nextValue(); json = new JSONTokener(gdxJSON.prettyPrint(JsonWriter.OutputType.json, 0)).nextValue();