refac: UnexpectedThrowable
This commit is contained in:
@@ -7,7 +7,9 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import org.lwjgl.Sys;
|
import org.lwjgl.Sys;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import ru.di9.minecraft.shared.UnexpectedThrowable;
|
||||||
|
|
||||||
|
@SuppressWarnings("all")
|
||||||
public class PanelCrashReport extends Panel
|
public class PanelCrashReport extends Panel
|
||||||
{
|
{
|
||||||
public PanelCrashReport(UnexpectedThrowable par1UnexpectedThrowable)
|
public PanelCrashReport(UnexpectedThrowable par1UnexpectedThrowable)
|
||||||
@@ -15,72 +17,72 @@ public class PanelCrashReport extends Panel
|
|||||||
setBackground(new Color(0x2e3444));
|
setBackground(new Color(0x2e3444));
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
StringWriter stringwriter = new StringWriter();
|
StringWriter stringwriter = new StringWriter();
|
||||||
par1UnexpectedThrowable.exception.printStackTrace(new PrintWriter(stringwriter));
|
par1UnexpectedThrowable.getCause().printStackTrace(new PrintWriter(stringwriter));
|
||||||
String s = stringwriter.toString();
|
String s = stringwriter.toString();
|
||||||
String s1 = "";
|
String s1 = "";
|
||||||
String s2 = "";
|
String s2 = "";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
s2 = (new StringBuilder()).append(s2).append("Generated ").append((new SimpleDateFormat()).format(new Date())).append("\n").toString();
|
s2 = s2 + "Generated " + (new SimpleDateFormat()).format(new Date()) + "\n";
|
||||||
s2 = (new StringBuilder()).append(s2).append("\n").toString();
|
s2 = s2 + "\n";
|
||||||
s2 = (new StringBuilder()).append(s2).append("Minecraft: Minecraft 1.2.5\n").toString();
|
s2 = s2 + "Minecraft: Minecraft 1.2.5\n";
|
||||||
s2 = (new StringBuilder()).append(s2).append("OS: ").append(System.getProperty("os.name")).append(" (").append(System.getProperty("os.arch")).append(") version ").append(System.getProperty("os.version")).append("\n").toString();
|
s2 = s2 + "OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version") + "\n";
|
||||||
s2 = (new StringBuilder()).append(s2).append("Java: ").append(System.getProperty("java.version")).append(", ").append(System.getProperty("java.vendor")).append("\n").toString();
|
s2 = s2 + "Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + "\n";
|
||||||
s2 = (new StringBuilder()).append(s2).append("VM: ").append(System.getProperty("java.vm.name")).append(" (").append(System.getProperty("java.vm.info")).append("), ").append(System.getProperty("java.vm.vendor")).append("\n").toString();
|
s2 = s2 + "VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor") + "\n";
|
||||||
s2 = (new StringBuilder()).append(s2).append("LWJGL: ").append(Sys.getVersion()).append("\n").toString();
|
s2 = s2 + "LWJGL: " + Sys.getVersion() + "\n";
|
||||||
s1 = GL11.glGetString(GL11.GL_VENDOR);
|
s1 = GL11.glGetString(GL11.GL_VENDOR);
|
||||||
s2 = (new StringBuilder()).append(s2).append("OpenGL: ").append(GL11.glGetString(GL11.GL_RENDERER)).append(" version ").append(GL11.glGetString(GL11.GL_VERSION)).append(", ").append(GL11.glGetString(GL11.GL_VENDOR)).append("\n").toString();
|
s2 = s2 + "OpenGL: " + GL11.glGetString(GL11.GL_RENDERER) + " version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR) + "\n";
|
||||||
}
|
}
|
||||||
catch (Throwable throwable)
|
catch (Throwable throwable)
|
||||||
{
|
{
|
||||||
s2 = (new StringBuilder()).append(s2).append("[failed to get system properties (").append(throwable).append(")]\n").toString();
|
s2 = s2 + "[failed to get system properties (" + throwable + ")]\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
s2 = (new StringBuilder()).append(s2).append("\n").toString();
|
s2 = s2 + "\n";
|
||||||
s2 = (new StringBuilder()).append(s2).append(s).toString();
|
s2 = s2 + s;
|
||||||
String s3 = "";
|
String s3 = "";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
|
|
||||||
if (s.contains("Pixel format not accelerated"))
|
if (s.contains("Pixel format not accelerated"))
|
||||||
{
|
{
|
||||||
s3 = (new StringBuilder()).append(s3).append(" Bad video card drivers! \n").toString();
|
s3 = s3 + " Bad video card drivers! \n";
|
||||||
s3 = (new StringBuilder()).append(s3).append(" ----------------------- \n").toString();
|
s3 = s3 + " ----------------------- \n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("Minecraft was unable to start because it failed to find an accelerated OpenGL mode.\n").toString();
|
s3 = s3 + "Minecraft was unable to start because it failed to find an accelerated OpenGL mode.\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("This can usually be fixed by updating the video card drivers.\n").toString();
|
s3 = s3 + "This can usually be fixed by updating the video card drivers.\n";
|
||||||
|
|
||||||
if (s1.toLowerCase().contains("nvidia"))
|
if (s1.toLowerCase().contains("nvidia"))
|
||||||
{
|
{
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("You might be able to find drivers for your video card here:\n").toString();
|
s3 = s3 + "You might be able to find drivers for your video card here:\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append(" http://www.nvidia.com/\n").toString();
|
s3 = s3 + " http://www.nvidia.com/\n";
|
||||||
}
|
}
|
||||||
else if (s1.toLowerCase().contains("ati"))
|
else if (s1.toLowerCase().contains("ati"))
|
||||||
{
|
{
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("You might be able to find drivers for your video card here:\n").toString();
|
s3 = s3 + "You might be able to find drivers for your video card here:\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append(" http://www.amd.com/\n").toString();
|
s3 = s3 + " http://www.amd.com/\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s3 = (new StringBuilder()).append(s3).append(" Minecraft has crashed! \n").toString();
|
s3 = s3 + " Minecraft has crashed! \n";
|
||||||
s3 = (new StringBuilder()).append(s3).append(" ---------------------- \n").toString();
|
s3 = s3 + " ---------------------- \n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("Minecraft has stopped running because it encountered a problem.\n").toString();
|
s3 = s3 + "Minecraft has stopped running because it encountered a problem.\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("--- BEGIN ERROR REPORT ").append(Integer.toHexString(s3.hashCode())).append(" --------\n").toString();
|
s3 = s3 + "--- BEGIN ERROR REPORT " + Integer.toHexString(s3.hashCode()) + " --------\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append(s2).toString();
|
s3 = s3 + s2;
|
||||||
s3 = (new StringBuilder()).append(s3).append("--- END ERROR REPORT ").append(Integer.toHexString(s3.hashCode())).append(" ----------\n").toString();
|
s3 = s3 + "--- END ERROR REPORT " + Integer.toHexString(s3.hashCode()) + " ----------\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
s3 = (new StringBuilder()).append(s3).append("\n").toString();
|
s3 = s3 + "\n";
|
||||||
TextArea textarea = new TextArea(s3, 0, 0, 1);
|
TextArea textarea = new TextArea(s3, 0, 0, 1);
|
||||||
textarea.setFont(new Font("Monospaced", 0, 12));
|
textarea.setFont(new Font("Monospaced", 0, 12));
|
||||||
add(new CanvasMojangLogo(), "North");
|
add(new CanvasMojangLogo(), "North");
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public class UnexpectedThrowable
|
|
||||||
{
|
|
||||||
/** A description of the error that has occurred. */
|
|
||||||
public final String description;
|
|
||||||
|
|
||||||
/** The Throwable object that was thrown. */
|
|
||||||
public final Throwable exception;
|
|
||||||
|
|
||||||
public UnexpectedThrowable(String par1Str, Throwable par2Throwable)
|
|
||||||
{
|
|
||||||
description = par1Str;
|
|
||||||
exception = par2Throwable;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package ru.di9.minecraft.shared;
|
||||||
|
|
||||||
|
public class UnexpectedThrowable extends RuntimeException {
|
||||||
|
public UnexpectedThrowable(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user