Archiviert
13
0

Fallback on our own custom object printer.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-12-12 18:35:58 +01:00
Ursprung 4440e6fcaa
Commit 86f15c8674

Datei anzeigen

@ -18,6 +18,7 @@ import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.reflect.PrettyPrinter;
import com.google.common.primitives.Primitives; import com.google.common.primitives.Primitives;
/** /**
@ -285,12 +286,15 @@ public class DetailedErrorReporter implements ErrorReporter {
return (ToStringBuilder.reflectionToString(value, ToStringStyle.MULTI_LINE_STYLE, false, null)); return (ToStringBuilder.reflectionToString(value, ToStringStyle.MULTI_LINE_STYLE, false, null));
} catch (Throwable ex) { } catch (Throwable ex) {
// Apache is probably missing // Apache is probably missing
logger.warning("Cannot find Apache Commons. Object introspection disabled.");
apacheCommonsMissing = true; apacheCommonsMissing = true;
} }
// Just use toString() // Use our custom object printer instead
return String.format("%s", value); try {
return PrettyPrinter.printObject(value, value.getClass(), Object.class);
} catch (IllegalAccessException e) {
return "[Error: " + e.getMessage() + "]";
}
} }
} }