summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWesley Wolfe <weswolf@aol.com>2012-08-17 23:11:26 -0500
committerWesley Wolfe <weswolf@aol.com>2012-08-17 23:18:22 -0500
commitcacfc71b46d30dc35f30848a9ce9d0fcfaae7b01 (patch)
tree0e0da59deb52a81c485f1a504c45ba2865035c9d
parentacedd049c5fd4a9627124a2d7df74540af581cba (diff)
downloadcraftbukkit-cacfc71b46d30dc35f30848a9ce9d0fcfaae7b01.tar
craftbukkit-cacfc71b46d30dc35f30848a9ce9d0fcfaae7b01.tar.gz
craftbukkit-cacfc71b46d30dc35f30848a9ce9d0fcfaae7b01.tar.lz
craftbukkit-cacfc71b46d30dc35f30848a9ce9d0fcfaae7b01.tar.xz
craftbukkit-cacfc71b46d30dc35f30848a9ce9d0fcfaae7b01.zip
Add more detailed CrashReport for CraftBukkit. Addresses BUKKIT-2319
-rw-r--r--src/main/java/net/minecraft/server/CrashReport.java1
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java41
2 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java
index a9e83166..42110c3a 100644
--- a/src/main/java/net/minecraft/server/CrashReport.java
+++ b/src/main/java/net/minecraft/server/CrashReport.java
@@ -35,6 +35,7 @@ public class CrashReport {
this.a("Java VM Version", (Callable) (new CrashReportJavaVMVersion(this)));
this.a("Memory", (Callable) (new CrashReportMemory(this)));
this.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
+ this.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
}
public void a(String s, Callable callable) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
new file mode 100644
index 00000000..72938bbb
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
@@ -0,0 +1,41 @@
+package org.bukkit.craftbukkit;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.PluginDescriptionFile;
+
+import net.minecraft.server.MinecraftServer;
+
+public class CraftCrashReport implements Callable {
+
+ public Object call() throws Exception {
+ StringWriter value = new StringWriter();
+ try {
+ value.append("\n Running: ").append(Bukkit.getName()).append(" version ").append(Bukkit.getVersion()).append(" (Implementing API version ").append(Bukkit.getBukkitVersion()).append(") ").append(String.valueOf(MinecraftServer.getServer().getOnlineMode()));
+ value.append("\n Plugins: {");
+ for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
+ PluginDescriptionFile description = plugin.getDescription();
+ value.append(' ').append(description.getFullName()).append(' ').append(description.getMain()).append(' ').append(Arrays.toString(description.getAuthors().toArray())).append(',');
+ }
+ value.append("}\n Warnings: ").append(Bukkit.getWarningState().name());
+ value.append("\n Threads: {");
+ for (Map.Entry<Thread, ? extends Object[]> entry : Thread.getAllStackTraces().entrySet()) {
+ value.append(' ').append(entry.getKey().getState().name()).append(' ').append(entry.getKey().getName()).append(": ").append(Arrays.toString(entry.getValue())).append(',');
+ }
+ value.append('}');
+ } catch (Throwable t) {
+ value.append("\n Failed to handle CraftCrashReport:\n");
+ PrintWriter writer = new PrintWriter(value);
+ t.printStackTrace(writer);
+ writer.flush();
+ }
+ return value.toString();
+ }
+
+}