Fix FMLCommonHandler#exitJava printing useless/wrong calling info (#4742)

This commit is contained in:
malte0811 2018-04-01 09:25:38 +02:00 committed by LexManos
parent 0b5a6a3b03
commit 7c098462fe

View file

@ -663,18 +663,17 @@ public class FMLCommonHandler
*/
public void exitJava(int exitCode, boolean hardExit)
{
FMLLog.log.info("Java has been asked to exit (code {}) by {}.", exitCode, Thread.currentThread().getStackTrace()[1]);
FMLLog.log.warn("Java has been asked to exit (code {})", exitCode);
if (hardExit)
{
FMLLog.log.info("This is an abortive exit and could cause world corruption or other things");
FMLLog.log.warn("This is an abortive exit and could cause world corruption or other things");
}
if (Boolean.parseBoolean(System.getProperty("fml.debugExit", "false")))
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
FMLLog.log.warn("Exit trace:");
//The first 2 elements are Thread#getStackTrace and FMLCommonHandler#exitJava and aren't relevant
for (int i = 2; i < stack.length; i++)
{
FMLLog.log.info("Exit trace", new Throwable());
}
else
{
FMLLog.log.info("If this was an unexpected exit, use -Dfml.debugExit=true as a JVM argument to find out where it was called");
FMLLog.log.warn("\t{}", stack[i]);
}
if (hardExit)
{