1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
--- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java
@@ -33,9 +33,10 @@
private StackTraceElement[] uncategorizedStackTrace = new StackTraceElement[0];
private final SystemReport systemReport = new SystemReport();
- public CrashReport(String s, Throwable throwable) {
- this.title = s;
- this.exception = throwable;
+ 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() {
@@ -53,38 +54,38 @@
return stringbuilder.toString();
}
- public void getDetails(StringBuilder stringbuilder) {
+ public void getDetails(StringBuilder builder) {
if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length <= 0) && !this.details.isEmpty()) {
this.uncategorizedStackTrace = (StackTraceElement[]) ArrayUtils.subarray(((CrashReportCategory) this.details.get(0)).getStacktrace(), 0, 1);
}
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
- stringbuilder.append("-- Head --\n");
- stringbuilder.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
- stringbuilder.append("Stacktrace:\n");
+ 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 (int j = 0; j < i; ++j) {
StackTraceElement stacktraceelement = astacktraceelement[j];
- stringbuilder.append("\t").append("at ").append(stacktraceelement);
- stringbuilder.append("\n");
+ builder.append("\t").append("at ").append(stacktraceelement);
+ builder.append("\n");
}
- stringbuilder.append("\n");
+ builder.append("\n");
}
Iterator iterator = this.details.iterator();
while (iterator.hasNext()) {
- CrashReportCategory crashreportcategory = (CrashReportCategory) iterator.next();
+ CrashReportCategory crashreportsystemdetails = (CrashReportCategory) iterator.next();
- crashreportcategory.getDetails(stringbuilder);
- stringbuilder.append("\n\n");
+ crashreportsystemdetails.getDetails(builder);
+ builder.append("\n\n");
}
- this.systemReport.appendToCrashReportString(stringbuilder);
+ this.systemReport.appendToCrashReportString(builder);
}
public String getExceptionMessage() {
@@ -149,12 +150,12 @@
return this.saveFile;
}
- public boolean saveToFile(File file) {
+ public boolean saveToFile(File toFile) {
if (this.saveFile != null) {
return false;
} else {
- if (file.getParentFile() != null) {
- file.getParentFile().mkdirs();
+ if (toFile.getParentFile() != null) {
+ toFile.getParentFile().mkdirs();
}
OutputStreamWriter outputstreamwriter = null;
@@ -162,14 +163,14 @@
boolean flag;
try {
- outputstreamwriter = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
+ outputstreamwriter = new OutputStreamWriter(new FileOutputStream(toFile), StandardCharsets.UTF_8);
outputstreamwriter.write(this.getFriendlyReport());
- this.saveFile = file;
+ this.saveFile = toFile;
boolean flag1 = true;
return flag1;
} catch (Throwable throwable) {
- CrashReport.LOGGER.error("Could not save crash report to {}", file, throwable);
+ CrashReport.LOGGER.error("Could not save crash report to {}", toFile, throwable);
flag = false;
} finally {
IOUtils.closeQuietly(outputstreamwriter);
@@ -183,15 +184,15 @@
return this.systemReport;
}
- public CrashReportCategory addCategory(String s) {
- return this.addCategory(s, 1);
+ public CrashReportCategory addCategory(String name) {
+ return this.addCategory(name, 1);
}
- public CrashReportCategory addCategory(String s, int i) {
- CrashReportCategory crashreportcategory = new CrashReportCategory(s);
+ public CrashReportCategory addCategory(String categoryName, int stacktraceLength) {
+ CrashReportCategory crashreportsystemdetails = new CrashReportCategory(categoryName);
if (this.trackingStackTrace) {
- int j = crashreportcategory.fillInStackTrace(i);
+ int j = crashreportsystemdetails.fillInStackTrace(stacktraceLength);
StackTraceElement[] astacktraceelement = this.exception.getStackTrace();
StackTraceElement stacktraceelement = null;
StackTraceElement stacktraceelement1 = null;
@@ -208,7 +209,7 @@
}
}
- this.trackingStackTrace = crashreportcategory.validateStackTrace(stacktraceelement, stacktraceelement1);
+ 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);
@@ -217,8 +218,8 @@
}
}
- this.details.add(crashreportcategory);
- return crashreportcategory;
+ this.details.add(crashreportsystemdetails);
+ return crashreportsystemdetails;
}
private static String getErrorComment() {
@@ -231,19 +232,19 @@
}
}
- public static CrashReport forThrowable(Throwable throwable, String s) {
- while (throwable instanceof CompletionException && throwable.getCause() != null) {
- throwable = throwable.getCause();
+ public static CrashReport forThrowable(Throwable cause, String description) {
+ while (cause instanceof CompletionException && cause.getCause() != null) {
+ cause = cause.getCause();
}
CrashReport crashreport;
- if (throwable instanceof ReportedException) {
- ReportedException reportedexception = (ReportedException) throwable;
+ if (cause instanceof ReportedException) {
+ ReportedException reportedexception = (ReportedException) cause;
crashreport = reportedexception.getReport();
} else {
- crashreport = new CrashReport(s, throwable);
+ crashreport = new CrashReport(description, cause);
}
return crashreport;
|