aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/CrashReport.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/CrashReport.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/CrashReport.java.patch343
1 files changed, 343 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/CrashReport.java.patch b/patch-remap/mache-vineflower/net/minecraft/CrashReport.java.patch
new file mode 100644
index 0000000000..b0b7dbf292
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/CrashReport.java.patch
@@ -0,0 +1,343 @@
+--- a/net/minecraft/CrashReport.java
++++ b/net/minecraft/CrashReport.java
+@@ -7,10 +7,10 @@
+ import java.io.OutputStreamWriter;
+ import java.io.PrintWriter;
+ import java.io.StringWriter;
+-import java.io.Writer;
+ import java.nio.charset.StandardCharsets;
+ import java.time.ZonedDateTime;
+ import java.time.format.DateTimeFormatter;
++import java.util.Iterator;
+ import java.util.List;
+ import java.util.Locale;
+ import java.util.concurrent.CompletionException;
+@@ -21,6 +21,7 @@
+ import org.slf4j.Logger;
+
+ public class CrashReport {
++
+ private static final Logger LOGGER = LogUtils.getLogger();
+ private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
+ private final String title;
+@@ -35,6 +36,7 @@
+ public CrashReport(String title, Throwable exception) {
+ this.title = title;
+ this.exception = exception;
++ this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
+ }
+
+ public String getTitle() {
+@@ -46,31 +48,40 @@
+ }
+
+ public String getDetails() {
+- StringBuilder stringBuilder = new StringBuilder();
+- this.getDetails(stringBuilder);
+- return stringBuilder.toString();
++ StringBuilder stringbuilder = new StringBuilder();
++
++ this.getDetails(stringbuilder);
++ return stringbuilder.toString();
+ }
+
+ public void getDetails(StringBuilder builder) {
+ if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length <= 0) && !this.details.isEmpty()) {
+- this.uncategorizedStackTrace = ArrayUtils.subarray(this.details.get(0).getStacktrace(), 0, 1);
++ this.uncategorizedStackTrace = (StackTraceElement[]) ArrayUtils.subarray(((CrashReportCategory) this.details.get(0)).getStacktrace(), 0, 1);
+ }
+
+ if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
+ builder.append("-- Head --\n");
+ builder.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
+ builder.append("Stacktrace:\n");
++ StackTraceElement[] astacktraceelement = this.uncategorizedStackTrace;
++ int i = astacktraceelement.length;
+
+- for (StackTraceElement stackTraceElement : this.uncategorizedStackTrace) {
+- builder.append("\t").append("at ").append(stackTraceElement);
++ for (int j = 0; j < i; ++j) {
++ StackTraceElement stacktraceelement = astacktraceelement[j];
++
++ builder.append("\t").append("at ").append(stacktraceelement);
+ builder.append("\n");
+ }
+
+ builder.append("\n");
+ }
+
+- for (CrashReportCategory crashReportCategory : this.details) {
+- crashReportCategory.getDetails(builder);
++ Iterator iterator = this.details.iterator();
++
++ while (iterator.hasNext()) {
++ CrashReportCategory crashreportsystemdetails = (CrashReportCategory) iterator.next();
++
++ crashreportsystemdetails.getDetails(builder);
+ builder.append("\n\n");
+ }
+
+@@ -78,57 +89,60 @@
+ }
+
+ public String getExceptionMessage() {
+- StringWriter stringWriter = null;
+- PrintWriter printWriter = null;
+- Throwable throwable = this.exception;
+- if (throwable.getMessage() == null) {
+- if (throwable instanceof NullPointerException) {
+- throwable = new NullPointerException(this.title);
+- } else if (throwable instanceof StackOverflowError) {
+- throwable = new StackOverflowError(this.title);
+- } else if (throwable instanceof OutOfMemoryError) {
+- throwable = new OutOfMemoryError(this.title);
++ StringWriter stringwriter = null;
++ PrintWriter printwriter = null;
++ Object object = this.exception;
++
++ if (((Throwable) object).getMessage() == null) {
++ if (object instanceof NullPointerException) {
++ object = new NullPointerException(this.title);
++ } else if (object instanceof StackOverflowError) {
++ object = new StackOverflowError(this.title);
++ } else if (object instanceof OutOfMemoryError) {
++ object = new OutOfMemoryError(this.title);
+ }
+
+- throwable.setStackTrace(this.exception.getStackTrace());
++ ((Throwable) object).setStackTrace(this.exception.getStackTrace());
+ }
+
+- String var4;
++ String s;
++
+ try {
+- stringWriter = new StringWriter();
+- printWriter = new PrintWriter(stringWriter);
+- throwable.printStackTrace(printWriter);
+- var4 = stringWriter.toString();
++ stringwriter = new StringWriter();
++ printwriter = new PrintWriter(stringwriter);
++ ((Throwable) object).printStackTrace(printwriter);
++ s = stringwriter.toString();
+ } finally {
+- IOUtils.closeQuietly((Writer)stringWriter);
+- IOUtils.closeQuietly((Writer)printWriter);
++ IOUtils.closeQuietly(stringwriter);
++ IOUtils.closeQuietly(printwriter);
+ }
+
+- return var4;
++ return s;
+ }
+
+ public String getFriendlyReport() {
+- StringBuilder stringBuilder = new StringBuilder();
+- stringBuilder.append("---- Minecraft Crash Report ----\n");
+- stringBuilder.append("// ");
+- stringBuilder.append(getErrorComment());
+- stringBuilder.append("\n\n");
+- stringBuilder.append("Time: ");
+- stringBuilder.append(DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
+- stringBuilder.append("\n");
+- stringBuilder.append("Description: ");
+- stringBuilder.append(this.title);
+- stringBuilder.append("\n\n");
+- stringBuilder.append(this.getExceptionMessage());
+- stringBuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
++ StringBuilder stringbuilder = new StringBuilder();
+
+- for (int i = 0; i < 87; i++) {
+- stringBuilder.append("-");
++ stringbuilder.append("---- Minecraft Crash Report ----\n");
++ stringbuilder.append("// ");
++ stringbuilder.append(getErrorComment());
++ stringbuilder.append("\n\n");
++ stringbuilder.append("Time: ");
++ stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
++ stringbuilder.append("\n");
++ stringbuilder.append("Description: ");
++ stringbuilder.append(this.title);
++ stringbuilder.append("\n\n");
++ stringbuilder.append(this.getExceptionMessage());
++ stringbuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
++
++ for (int i = 0; i < 87; ++i) {
++ stringbuilder.append("-");
+ }
+
+- stringBuilder.append("\n\n");
+- this.getDetails(stringBuilder);
+- return stringBuilder.toString();
++ stringbuilder.append("\n\n");
++ this.getDetails(stringbuilder);
++ return stringbuilder.toString();
+ }
+
+ @Nullable
+@@ -144,22 +158,25 @@
+ toFile.getParentFile().mkdirs();
+ }
+
+- Writer writer = null;
++ OutputStreamWriter outputstreamwriter = null;
+
+- boolean var4;
++ boolean flag;
++
+ try {
+- writer = new OutputStreamWriter(new FileOutputStream(toFile), StandardCharsets.UTF_8);
+- writer.write(this.getFriendlyReport());
++ outputstreamwriter = new OutputStreamWriter(new FileOutputStream(toFile), StandardCharsets.UTF_8);
++ outputstreamwriter.write(this.getFriendlyReport());
+ this.saveFile = toFile;
+- return true;
+- } catch (Throwable var8) {
+- LOGGER.error("Could not save crash report to {}", toFile, var8);
+- var4 = false;
++ boolean flag1 = true;
++
++ return flag1;
++ } catch (Throwable throwable) {
++ CrashReport.LOGGER.error("Could not save crash report to {}", toFile, throwable);
++ flag = false;
+ } finally {
+- IOUtils.closeQuietly(writer);
++ IOUtils.closeQuietly(outputstreamwriter);
+ }
+
+- return var4;
++ return flag;
+ }
+ }
+
+@@ -172,78 +189,45 @@
+ }
+
+ public CrashReportCategory addCategory(String categoryName, int stacktraceLength) {
+- CrashReportCategory crashReportCategory = new CrashReportCategory(categoryName);
++ CrashReportCategory crashreportsystemdetails = new CrashReportCategory(categoryName);
++
+ if (this.trackingStackTrace) {
+- int i = crashReportCategory.fillInStackTrace(stacktraceLength);
+- StackTraceElement[] stackTrace = this.exception.getStackTrace();
+- StackTraceElement stackTraceElement = null;
+- StackTraceElement stackTraceElement1 = null;
+- int i1 = stackTrace.length - i;
+- if (i1 < 0) {
+- LOGGER.error("Negative index in crash report handler ({}/{})", stackTrace.length, i);
++ int j = crashreportsystemdetails.fillInStackTrace(stacktraceLength);
++ StackTraceElement[] astacktraceelement = this.exception.getStackTrace();
++ StackTraceElement stacktraceelement = null;
++ StackTraceElement stacktraceelement1 = null;
++ int k = astacktraceelement.length - j;
++
++ if (k < 0) {
++ CrashReport.LOGGER.error("Negative index in crash report handler ({}/{})", astacktraceelement.length, j);
+ }
+
+- if (stackTrace != null && 0 <= i1 && i1 < stackTrace.length) {
+- stackTraceElement = stackTrace[i1];
+- if (stackTrace.length + 1 - i < stackTrace.length) {
+- stackTraceElement1 = stackTrace[stackTrace.length + 1 - i];
++ if (astacktraceelement != null && 0 <= k && k < astacktraceelement.length) {
++ stacktraceelement = astacktraceelement[k];
++ if (astacktraceelement.length + 1 - j < astacktraceelement.length) {
++ stacktraceelement1 = astacktraceelement[astacktraceelement.length + 1 - j];
+ }
+ }
+
+- this.trackingStackTrace = crashReportCategory.validateStackTrace(stackTraceElement, stackTraceElement1);
+- if (stackTrace != null && stackTrace.length >= i && 0 <= i1 && i1 < stackTrace.length) {
+- this.uncategorizedStackTrace = new StackTraceElement[i1];
+- System.arraycopy(stackTrace, 0, this.uncategorizedStackTrace, 0, this.uncategorizedStackTrace.length);
++ this.trackingStackTrace = crashreportsystemdetails.validateStackTrace(stacktraceelement, stacktraceelement1);
++ if (astacktraceelement != null && astacktraceelement.length >= j && 0 <= k && k < astacktraceelement.length) {
++ this.uncategorizedStackTrace = new StackTraceElement[k];
++ System.arraycopy(astacktraceelement, 0, this.uncategorizedStackTrace, 0, this.uncategorizedStackTrace.length);
+ } else {
+ this.trackingStackTrace = false;
+ }
+ }
+
+- this.details.add(crashReportCategory);
+- return crashReportCategory;
++ this.details.add(crashreportsystemdetails);
++ return crashreportsystemdetails;
+ }
+
+ private static String getErrorComment() {
+- String[] strings = new String[]{
+- "Who set us up the TNT?",
+- "Everything's going to plan. No, really, that was supposed to happen.",
+- "Uh... Did I do that?",
+- "Oops.",
+- "Why did you do that?",
+- "I feel sad now :(",
+- "My bad.",
+- "I'm sorry, Dave.",
+- "I let you down. Sorry :(",
+- "On the bright side, I bought you a teddy bear!",
+- "Daisy, daisy...",
+- "Oh - I know what I did wrong!",
+- "Hey, that tickles! Hehehe!",
+- "I blame Dinnerbone.",
+- "You should try our sister game, Minceraft!",
+- "Don't be sad. I'll do better next time, I promise!",
+- "Don't be sad, have a hug! <3",
+- "I just don't know what went wrong :(",
+- "Shall we play a game?",
+- "Quite honestly, I wouldn't worry myself about that.",
+- "I bet Cylons wouldn't have this problem.",
+- "Sorry :(",
+- "Surprise! Haha. Well, this is awkward.",
+- "Would you like a cupcake?",
+- "Hi. I'm Minecraft, and I'm a crashaholic.",
+- "Ooh. Shiny.",
+- "This doesn't make any sense!",
+- "Why is it breaking :(",
+- "Don't do that.",
+- "Ouch. That hurt :(",
+- "You're mean.",
+- "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]",
+- "There are four lights!",
+- "But it works on my machine."
+- };
++ String[] astring = new String[]{"Who set us up the TNT?", "Everything's going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I'm sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don't be sad. I'll do better next time, I promise!", "Don't be sad, have a hug! <3", "I just don't know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn't worry myself about that.", "I bet Cylons wouldn't have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I'm Minecraft, and I'm a crashaholic.", "Ooh. Shiny.", "This doesn't make any sense!", "Why is it breaking :(", "Don't do that.", "Ouch. That hurt :(", "You're mean.", "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]", "There are four lights!", "But it works on my machine."};
+
+ try {
+- return strings[(int)(Util.getNanos() % (long)strings.length)];
+- } catch (Throwable var2) {
++ return astring[(int) (Util.getNanos() % (long) astring.length)];
++ } catch (Throwable throwable) {
+ return "Witty comment unavailable :(";
+ }
+ }
+@@ -253,18 +237,21 @@
+ cause = cause.getCause();
+ }
+
+- CrashReport report;
+- if (cause instanceof ReportedException reportedException) {
+- report = reportedException.getReport();
++ CrashReport crashreport;
++
++ if (cause instanceof ReportedException) {
++ ReportedException reportedexception = (ReportedException) cause;
++
++ crashreport = reportedexception.getReport();
+ } else {
+- report = new CrashReport(description, cause);
++ crashreport = new CrashReport(description, cause);
+ }
+
+- return report;
++ return crashreport;
+ }
+
+ public static void preload() {
+ MemoryReserve.allocate();
+- new CrashReport("Don't panic!", new Throwable()).getFriendlyReport();
++ (new CrashReport("Don't panic!", new Throwable())).getFriendlyReport();
+ }
+ }