update crash suggestions.
This commit is contained in:
@@ -124,15 +124,13 @@ public final class Launcher {
|
||||
minecraftMain.invoke(null, new Object[]{cmds});
|
||||
} catch (Throwable throwable) {
|
||||
HMCLog.err("Cought exception!");
|
||||
final StringWriter trace = new StringWriter();
|
||||
PrintWriter writer = new PrintWriter(trace);
|
||||
throwable.printStackTrace(writer);
|
||||
final String advice = MinecraftCrashAdvicer.getAdvice(throwable);
|
||||
String trace = StrUtils.getStackTrace(throwable);
|
||||
final String advice = MinecraftCrashAdvicer.getAdvice(trace);
|
||||
MessageBox.Show(C.i18n("crash.minecraft") + ": " + advice);
|
||||
|
||||
LogWindow.instance.log(C.i18n("crash.minecraft"));
|
||||
LogWindow.instance.log(advice);
|
||||
LogWindow.instance.log(trace.toString());
|
||||
LogWindow.instance.log(trace);
|
||||
LogWindow.instance.setExit(TrueFunction.instance);
|
||||
LogWindow.instance.setVisible(true);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.launch;
|
||||
|
||||
import java.util.ConcurrentModificationException;
|
||||
import org.jackhuang.hellominecraft.C;
|
||||
|
||||
/**
|
||||
@@ -26,32 +25,42 @@ import org.jackhuang.hellominecraft.C;
|
||||
*/
|
||||
public final class MinecraftCrashAdvicer {
|
||||
|
||||
public static String getAdvice(Throwable t) {
|
||||
return getAdvice(t, false);
|
||||
public static String getAdvice(String trace) {
|
||||
return getAdvice(trace, false);
|
||||
}
|
||||
|
||||
public static String getAdvice(Throwable t, boolean selfCrash) {
|
||||
if (t.getCause() instanceof UnsupportedClassVersionError) {
|
||||
public static String getAdvice(String trace, boolean selfCrash) {
|
||||
/*if (t.getCause() instanceof UnsupportedClassVersionError) {
|
||||
return C.i18n("crash.advice.UnsupportedClassVersionError");
|
||||
} else if (t instanceof ConcurrentModificationException) {
|
||||
return C.i18n("crash.advice.ConcurrentModificationException");
|
||||
} else if (t instanceof SecurityException) {
|
||||
return C.i18n("crash.advice.SecurityException");
|
||||
} else if (t instanceof InvocationTargetException) {
|
||||
return C.i18n("crash.advice.InvocationTargetException");
|
||||
} else if (t instanceof NoSuchFieldError || (t.getCause() != null && t.getCause() instanceof NoSuchFieldException)) {
|
||||
return C.i18n("crash.advice.NoSuchFieldError");
|
||||
} else if (t instanceof NoClassDefFoundError || (t.getCause() != null && t.getCause() instanceof ClassNotFoundException)) {
|
||||
} else if (t instanceof NoClassDefFoundError || t instanceof ClassNotFoundException || (t.getCause() != null && t.getCause() instanceof ClassNotFoundException)) {
|
||||
return C.i18n("crash.advice.ClassNotFondException");
|
||||
}
|
||||
|
||||
if (t.getMessage() != null) {
|
||||
if (t.getMessage().contains("OpenGL") || t.getMessage().contains("OpenAL")) {
|
||||
return C.i18n("crash.advice.OpenGL");
|
||||
}
|
||||
}
|
||||
if (t.getCause() != null && t.getCause().getMessage() != null) {
|
||||
if (t.getCause().getMessage().contains("no lwjgl in java.library.path")) {
|
||||
return C.i18n("crash.advice.no_lwjgl");
|
||||
}
|
||||
}*/
|
||||
|
||||
if (trace.contains("LWJGLException")) {
|
||||
if(trace.contains("Pixel format not accelerated"))
|
||||
return C.i18n("crash.advice.LWJGLException");
|
||||
} else if (trace.contains("UnsupportedClassVersionError")) {
|
||||
return C.i18n("crash.advice.UnsupportedClassVersionError");
|
||||
} else if (trace.contains("ConcurrentModificationException")) {
|
||||
return C.i18n("crash.advice.ConcurrentModificationException");
|
||||
} else if (trace.contains("SecurityException")) {
|
||||
return C.i18n("crash.advice.SecurityException");
|
||||
} else if (trace.contains("NoSuchFieldException") || trace.contains("NoSuchFieldError")) {
|
||||
return C.i18n("crash.advice.NoSuchFieldError");
|
||||
} else if (trace.contains("NoClassDefFoundError") || trace.contains("ClassNotFoundException")) {
|
||||
return C.i18n("crash.advice.ClassNotFondException");
|
||||
} else if (trace.contains("no lwjgl in java.library.path")) {
|
||||
return C.i18n("crash.advice.no_lwjgl");
|
||||
} else if (trace.contains("OpenGL") || trace.contains("OpenAL")) {
|
||||
return C.i18n("crash.advice.OpenGL");
|
||||
}
|
||||
return selfCrash ? C.i18n("crash.advice.no") : C.i18n("crash.advice.otherwise");
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CrashReport implements Thread.UncaughtExceptionHandler {
|
||||
text += " Time: " + DateFormat.getDateInstance().format(new Date()) + "\n";
|
||||
text += " Thread: " + t.toString() + "\n";
|
||||
text += "\n Advice: \n ";
|
||||
text += MinecraftCrashAdvicer.getAdvice(e, true);
|
||||
text += MinecraftCrashAdvicer.getAdvice(StrUtils.getStackTrace(e), true);
|
||||
text += "\n Content: \n ";
|
||||
text += StrUtils.getStackTrace(e) + "\n\n";
|
||||
text += "-- System Details --\n";
|
||||
|
||||
Reference in New Issue
Block a user