diff --git a/src/main/java/ru/windcorp/progressia/client/comms/DefaultClientCommsListener.java b/src/main/java/ru/windcorp/progressia/client/comms/DefaultClientCommsListener.java index b2c7051..4053672 100644 --- a/src/main/java/ru/windcorp/progressia/client/comms/DefaultClientCommsListener.java +++ b/src/main/java/ru/windcorp/progressia/client/comms/DefaultClientCommsListener.java @@ -1,6 +1,8 @@ package ru.windcorp.progressia.client.comms; import java.io.IOException; + +import ru.windcorp.jputil.chars.StringUtil; import ru.windcorp.progressia.client.Client; import ru.windcorp.progressia.client.graphics.world.EntityAnchor; import ru.windcorp.progressia.client.world.ChunkRender; @@ -42,7 +44,11 @@ public class DefaultClientCommsListener implements CommsListener { ); if (entity == null) { - CrashReports.report(null, "Player entity not found"); + CrashReports.report( + null, + "Player entity with ID %s not found", + new String(StringUtil.toFullHex(packet.getLocalPlayerEntityId())) + ); } getClient().setLocalPlayer(entity); diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/Program.java b/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/Program.java index 64c54bc..2b63885 100644 --- a/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/Program.java +++ b/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/Program.java @@ -40,7 +40,7 @@ public class Program implements OpenGLDeletable { glLinkProgram(handle); if (glGetProgrami(handle, GL_LINK_STATUS) == GL_FALSE) { - CrashReports.report(null, "Bad program:\n %s", glGetProgramInfoLog(handle)); + CrashReports.report(null, "Bad program:\n%s", glGetProgramInfoLog(handle)); } } diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/attributes/Attribute.java b/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/attributes/Attribute.java index 34624f4..9075085 100644 --- a/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/attributes/Attribute.java +++ b/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/attributes/Attribute.java @@ -27,7 +27,7 @@ public class Attribute { public Attribute(int handle, Program program) { if (handle < 0) { - CrashReports.report(null, "Bad handle: %s", handle); + CrashReports.report(null, "Bad handle: %d", handle); } this.handle = handle; diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/uniforms/Uniform.java b/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/uniforms/Uniform.java index d1475b0..996b1fe 100644 --- a/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/uniforms/Uniform.java +++ b/src/main/java/ru/windcorp/progressia/client/graphics/backend/shaders/uniforms/Uniform.java @@ -27,7 +27,7 @@ public class Uniform { public Uniform(int handle, Program program) { if (handle < 0) { - CrashReports.report(null, "Bad handle: %s", handle); + CrashReports.report(null, "Bad handle: %d", handle); } this.handle = handle; diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/font/GNUUnifontLoader.java b/src/main/java/ru/windcorp/progressia/client/graphics/font/GNUUnifontLoader.java index 61e9666..72f359c 100644 --- a/src/main/java/ru/windcorp/progressia/client/graphics/font/GNUUnifontLoader.java +++ b/src/main/java/ru/windcorp/progressia/client/graphics/font/GNUUnifontLoader.java @@ -57,7 +57,7 @@ public class GNUUnifontLoader { return createStream(reader).map(GNUUnifontLoader::parse).map(GNUUnifontLoader::addToAtlas) .collect(Collectors.collectingAndThen(createMapper(), GNUUnifont::new)); } catch (IOException | UncheckedIOException e) { - CrashReports.report(e, "Problem with load GNUUnifont"); + CrashReports.report(e, "Could not load GNUUnifont"); return null; } } @@ -72,23 +72,30 @@ public class GNUUnifontLoader { } private static ParsedGlyph parse(String declar) { - int width = getWidth(declar); - checkDeclaration(declar, width); - - char c = getChar(declar); - - TextureDataEditor editor = new TextureDataEditor(width, GNUUnifont.HEIGHT, width, GNUUnifont.HEIGHT, - TEXTURE_SETTINGS); - - for (int y = 0; y < GNUUnifont.HEIGHT; ++y) { - for (int x = 0; x < width; ++x) { - int bit = x + y * width; - - editor.setPixel(x, GNUUnifont.HEIGHT - y - 1, getBit(declar, bit) ? 0xFFFFFFFF : 0x00000000); + try { + + int width = getWidth(declar); + checkDeclaration(declar, width); + + char c = getChar(declar); + + TextureDataEditor editor = new TextureDataEditor(width, GNUUnifont.HEIGHT, width, GNUUnifont.HEIGHT, + TEXTURE_SETTINGS); + + for (int y = 0; y < GNUUnifont.HEIGHT; ++y) { + for (int x = 0; x < width; ++x) { + int bit = x + y * width; + + editor.setPixel(x, GNUUnifont.HEIGHT - y - 1, getBit(declar, bit) ? 0xFFFFFFFF : 0x00000000); + } } + + return new ParsedGlyph(c, editor); + + } catch (IOException e) { + CrashReports.report(e, "Could not load GNUUnifont: could not load character \"%s\"", declar); + return null; } - - return new ParsedGlyph(c, editor); } private static char getChar(String declar) { @@ -117,26 +124,25 @@ public class GNUUnifontLoader { return meaningfulChars / charsPerColumn; } - private static void checkDeclaration(String declar, int width) { + private static void checkDeclaration(String declar, int width) throws IOException { if (!GNUUnifont.WIDTHS.contains(width)) { - CrashReports.report(null, "Width %d is not supported (in declar \"%s\")", width, declar); + throw new IOException("Width " + width + " is not supported (in declar \"" + declar + "\")"); } - + if ((declar.length() - PREFIX_LENGTH) % width != 0) { - CrashReports.report(null, "Declar \"%s\" has invalid length", declar); + throw new IOException("Declar \"" + declar + "\" has invalid length"); } - + for (int i = 0; i < declar.length(); ++i) { if (i == BITS_PER_HEX_DIGIT) { if (declar.charAt(i) != ':') { - CrashReports.report(null, "No colon ':' found in declar \"%s\" at index 4", declar); + throw new IOException("No colon ':' found in declar \"" + declar + "\" at index 4"); } } else { char c = declar.charAt(i); - + if (!((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F'))) { - CrashReports.report(null, - "Illegal char in declar \"%s\" at index " + i + "; expected 0-9A-F", declar); + throw new IOException("Illegal char in declar \"" + declar + "\" at index " + i + "; expected 0-9A-F"); } } } diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Component.java b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Component.java index 7ba1b83..1a1b1f4 100755 --- a/src/main/java/ru/windcorp/progressia/client/graphics/gui/Component.java +++ b/src/main/java/ru/windcorp/progressia/client/graphics/gui/Component.java @@ -235,7 +235,7 @@ public class Component extends Named { valid = true; } catch (Exception e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Could not layout Component %s", this); } } @@ -248,7 +248,7 @@ public class Component extends Named { try { return getLayout().calculatePreferredSize(this); } catch (Exception e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Could not calculate preferred size for Component %s", this); } } @@ -517,7 +517,7 @@ public class Component extends Named { break; } } catch (Exception e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Could not dispatch input to Component %s", this); } } @@ -609,7 +609,7 @@ public class Component extends Named { try { assembleSelf(target); } catch (Exception e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Could not assemble Component %s", this); } assembleChildren(target); @@ -617,7 +617,7 @@ public class Component extends Named { try { postAssembleSelf(target); } catch (Exception e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Post-assembly failed for Component %s", this); } } diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/texture/Atlases.java b/src/main/java/ru/windcorp/progressia/client/graphics/texture/Atlases.java index a945f03..0ce64d4 100644 --- a/src/main/java/ru/windcorp/progressia/client/graphics/texture/Atlases.java +++ b/src/main/java/ru/windcorp/progressia/client/graphics/texture/Atlases.java @@ -157,7 +157,7 @@ public class Atlases { return loadSprite(data.getData(), group); } catch (IOException e) { - CrashReports.report(e, "Problem with load atlases sprite"); + CrashReports.report(e, "Could not load sprite %s into atlas group %s", resource, group); return null; } } @@ -174,7 +174,7 @@ public class Atlases { Atlas newAtlas = new Atlas(group); if (!newAtlas.canAddSprite(data)) { - CrashReports.report(null, "Could not fit tex into atlas of size %d", newAtlas.getSize()); + CrashReports.report(null, "Could not fit texture into atlas of size %d", newAtlas.getSize()); } atlases.add(newAtlas); diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/texture/SimpleTextures.java b/src/main/java/ru/windcorp/progressia/client/graphics/texture/SimpleTextures.java index e0711db..51a1235 100644 --- a/src/main/java/ru/windcorp/progressia/client/graphics/texture/SimpleTextures.java +++ b/src/main/java/ru/windcorp/progressia/client/graphics/texture/SimpleTextures.java @@ -31,7 +31,7 @@ public class SimpleTextures { new Sprite(new TexturePrimitive(data.getData())) ); } catch (IOException e) { - CrashReports.report(e, "Problem with load texture"); + CrashReports.report(e, "Could not load texture %s", resource); return null; } diff --git a/src/main/java/ru/windcorp/progressia/client/graphics/texture/TexturePrimitive.java b/src/main/java/ru/windcorp/progressia/client/graphics/texture/TexturePrimitive.java index e4f5fdc..b4df4fb 100644 --- a/src/main/java/ru/windcorp/progressia/client/graphics/texture/TexturePrimitive.java +++ b/src/main/java/ru/windcorp/progressia/client/graphics/texture/TexturePrimitive.java @@ -90,7 +90,7 @@ public class TexturePrimitive implements OpenGLDeletable { OpenGLObjectTracker.register(this); if (handle < 0) { - CrashReports.report(null, "Failed to create texture"); + CrashReports.report(null, "Failed to allocate texture"); } } diff --git a/src/main/java/ru/windcorp/progressia/client/localization/Parser.java b/src/main/java/ru/windcorp/progressia/client/localization/Parser.java index c0438d5..239c779 100644 --- a/src/main/java/ru/windcorp/progressia/client/localization/Parser.java +++ b/src/main/java/ru/windcorp/progressia/client/localization/Parser.java @@ -81,7 +81,7 @@ public class Parser { } } catch (IOException | EscapeException e) { - CrashReports.report(e, "Problems with parsing"); + CrashReports.report(e, "Could not parse language file %s", filePath); return null; } return parsedData; diff --git a/src/main/java/ru/windcorp/progressia/client/world/entity/EntityRenderRegistry.java b/src/main/java/ru/windcorp/progressia/client/world/entity/EntityRenderRegistry.java index 1e33fd3..ad0c161 100644 --- a/src/main/java/ru/windcorp/progressia/client/world/entity/EntityRenderRegistry.java +++ b/src/main/java/ru/windcorp/progressia/client/world/entity/EntityRenderRegistry.java @@ -29,7 +29,7 @@ public class EntityRenderRegistry extends NamespacedRegistry { ).getData() ); } catch (IOException e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Could not load entity texture %s", name); return null; } } diff --git a/src/main/java/ru/windcorp/progressia/common/resource/Resource.java b/src/main/java/ru/windcorp/progressia/common/resource/Resource.java index d2e42ea..43b1839 100644 --- a/src/main/java/ru/windcorp/progressia/common/resource/Resource.java +++ b/src/main/java/ru/windcorp/progressia/common/resource/Resource.java @@ -51,7 +51,7 @@ public class Resource extends Named { try (Reader reader = getReader()) { return CharStreams.toString(reader); } catch (IOException e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Could not read resource %s as text", this); return null; } } @@ -61,7 +61,7 @@ public class Resource extends Named { try (InputStream stream = getInputStream()) { byteArray = ByteStreams.toByteArray(stream); } catch (IOException e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Could not read resource %s as bytes", this); return null; } diff --git a/src/main/java/ru/windcorp/progressia/server/world/ImplementedChangeTracker.java b/src/main/java/ru/windcorp/progressia/server/world/ImplementedChangeTracker.java index 960f77d..f277cb1 100644 --- a/src/main/java/ru/windcorp/progressia/server/world/ImplementedChangeTracker.java +++ b/src/main/java/ru/windcorp/progressia/server/world/ImplementedChangeTracker.java @@ -134,7 +134,7 @@ public class ImplementedChangeTracker implements Changer { try { entity.write(packet.getWriter(), IOContext.COMMS); } catch (IOException e) { - CrashReports.report(e, "__DOC__ME__"); + CrashReports.report(e, "Could not write entity %s", entity); } } @@ -146,7 +146,7 @@ public class ImplementedChangeTracker implements Changer { try { entity.write(packet.getWriter(), IOContext.COMMS); } catch (IOException e) { - CrashReports.report(e, "Entity could not be written"); + CrashReports.report(e, "Could not write entity %s", entity); } }