mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 16:49:10 +00:00
[CLEANUP] Formatted code
This commit is contained in:
+21
-7
@@ -13,11 +13,24 @@ import java.io.IOException;
|
|||||||
* Writes exceptions to a file and reports the file location back to the user
|
* Writes exceptions to a file and reports the file location back to the user
|
||||||
*/
|
*/
|
||||||
public class FileExceptionHandler extends ExceptionHandler {
|
public class FileExceptionHandler extends ExceptionHandler {
|
||||||
|
/**
|
||||||
|
* The default index of all options to be selected when the popup appears
|
||||||
|
*/
|
||||||
|
private static final int defaultOptionIndex = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory where the reports get written to
|
* Directory where the reports get written to
|
||||||
*/
|
*/
|
||||||
private final File reportsDirectory;
|
private final File reportsDirectory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All possible options to select when the popup appears
|
||||||
|
*/
|
||||||
|
private final Object[] options = new Object[]{
|
||||||
|
"Close",
|
||||||
|
"Open report",
|
||||||
|
"Ignore " + this.getExceptionType().getName().toLowerCase() + " errors" };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines if the alert should popup during this client instance again
|
* Defines if the alert should popup during this client instance again
|
||||||
*/
|
*/
|
||||||
@@ -44,10 +57,14 @@ public class FileExceptionHandler extends ExceptionHandler {
|
|||||||
report.createNewFile();
|
report.createNewFile();
|
||||||
|
|
||||||
StringBuilder reportContent = new StringBuilder();
|
StringBuilder reportContent = new StringBuilder();
|
||||||
reportContent.append(e.getMessage() + "\n\n");
|
reportContent.append("Message: ").append(e.getMessage()).append("\n\n");
|
||||||
|
reportContent.append(e.toString()).append("\n\n");
|
||||||
|
|
||||||
for (int i = 0; i < e.getStackTrace().length; i++) {
|
for (int i = 0; i < e.getStackTrace().length; i++) {
|
||||||
reportContent.append((i > 0 ? " " : "") + e.getStackTrace()[i] + "\n");
|
if (i > 0) {
|
||||||
|
reportContent.append("\t");
|
||||||
|
}
|
||||||
|
reportContent.append(e.getStackTrace()[i]).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
FileUtil.writeFileContents(report, reportContent.toString());
|
FileUtil.writeFileContents(report, reportContent.toString());
|
||||||
@@ -84,11 +101,8 @@ public class FileExceptionHandler extends ExceptionHandler {
|
|||||||
"We are sorry to inform you that an error occurred within Parabot.\n\n" +
|
"We are sorry to inform you that an error occurred within Parabot.\n\n" +
|
||||||
"The error has been written to a report file.\n" +
|
"The error has been written to a report file.\n" +
|
||||||
"Please report the error to the Parabot staff with as much information as possible.",
|
"Please report the error to the Parabot staff with as much information as possible.",
|
||||||
new Object[]{
|
this.options,
|
||||||
"Close",
|
defaultOptionIndex,
|
||||||
"Open report",
|
|
||||||
"Ignore " + this.getExceptionType().getName().toLowerCase() + " errors" },
|
|
||||||
1,
|
|
||||||
JOptionPane.WARNING_MESSAGE
|
JOptionPane.WARNING_MESSAGE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user