3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-19 02:20:04 +02:00

Fix InformativeException NPE

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-11-08 12:09:08 +01:00
Ursprung 3aa84b5a5a
Commit ad7f782a1a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -43,25 +43,21 @@ public class InformativeException extends Exception {
} }
private String getSource(Class<?> sourceClazz) { private String getSource(Class<?> sourceClazz) {
if (sourceClazz.isAnonymousClass()) { return sourceClazz.isAnonymousClass() ? sourceClazz.getName() + " (Anonymous)" : sourceClazz.getName();
return sourceClazz.getName() + " (Anonymous)";
} else {
return sourceClazz.getName();
}
} }
@Override @Override
public String getMessage() { public String getMessage() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder("Please post this error to https://github.com/ViaVersion/ViaVersion/issues and follow the issue template\n{");
builder.append("Please post this error to https://github.com/ViaVersion/ViaVersion/issues and follow the issue template\n{"); boolean first = true;
int i = 0;
for (Map.Entry<String, Object> entry : info.entrySet()) { for (Map.Entry<String, Object> entry : info.entrySet()) {
builder.append(i == 0 ? "" : ", ").append(entry.getKey()).append(": ").append(entry.getValue().toString()); if (!first) {
i++; builder.append(", ");
}
builder.append(entry.getKey()).append(": ").append(entry.getValue());
first = false;
} }
builder.append("}\nActual Error: "); return builder.append("}\nActual Error: ").toString();
return builder.toString();
} }
@Override @Override