ExceptionUtils.java
1.4 KB
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
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.airport.util;
import java.io.PrintWriter;
import java.io.StringWriter;
public class ExceptionUtils {
public ExceptionUtils() {
}
public static String outputExceptionDetailsInfo(String label, String msg, Throwable t) {
StringBuffer sb = new StringBuffer();
StackTraceElement[] messages = t.getStackTrace();
int length = messages.length;
sb.append("\n");
sb.append("\n");
sb.append("\t");
sb.append("[");
sb.append(label + " component exception super class name");
sb.append(":");
sb.append(msg);
sb.append("]");
sb.append("\n");
sb.append("\t********Exception Detail List Begin********");
sb.append("\n\t" + t + "\n");
for(int i = 0; i < length; ++i) {
sb.append("\t" + messages[i].toString() + "\n");
}
sb.append("\t********Exception Detail List End********");
return sb.toString();
}
public static String getStackTrace(Throwable t) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
String var4;
try {
t.printStackTrace(pw);
var4 = sw.toString();
} finally {
pw.close();
}
return var4;
}
}