3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 13:52:50 +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) {
if (sourceClazz.isAnonymousClass()) {
return sourceClazz.getName() + " (Anonymous)";
} else {
return sourceClazz.getName();
}
return sourceClazz.isAnonymousClass() ? sourceClazz.getName() + " (Anonymous)" : sourceClazz.getName();
}
@Override
public String getMessage() {
StringBuilder builder = new StringBuilder();
builder.append("Please post this error to https://github.com/ViaVersion/ViaVersion/issues and follow the issue template\n{");
int i = 0;
StringBuilder builder = new StringBuilder("Please post this error to https://github.com/ViaVersion/ViaVersion/issues and follow the issue template\n{");
boolean first = true;
for (Map.Entry<String, Object> entry : info.entrySet()) {
builder.append(i == 0 ? "" : ", ").append(entry.getKey()).append(": ").append(entry.getValue().toString());
i++;
if (!first) {
builder.append(", ");
}
builder.append(entry.getKey()).append(": ").append(entry.getValue());
first = false;
}
builder.append("}\nActual Error: ");
return builder.toString();
return builder.append("}\nActual Error: ").toString();
}
@Override