1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package servletunit.struts;
17
18 import java.io.*;
19 import javax.servlet.ServletException;
20
21
22
23
24
25
26
27
28 public class ExceptionDuringTestError extends Error {
29
30 Throwable rootCause;
31
32 public ExceptionDuringTestError(String message, Throwable rootCause) {
33 super(message);
34 this.rootCause = rootCause;
35 }
36
37 public void printStackTrace(){
38 super.printStackTrace();
39 System.out.println("------------");
40 System.out.println("Root Cause:");
41 System.out.println("------------");
42 rootCause.printStackTrace();
43 if (rootCause instanceof ServletException){
44 Throwable root2 = ((ServletException)rootCause).getRootCause();
45 if(root2!=null){
46 System.out.println("------------");
47 System.out.println("Root Cause:");
48 System.out.println("------------");
49 root2.printStackTrace();
50 }
51 }
52 }
53
54 public void printStackTrace(PrintStream stream){
55 super.printStackTrace(stream);
56 stream.println("------------");
57 stream.println("Root Cause:");
58 stream.println("------------");
59 rootCause.printStackTrace(stream);
60 if (rootCause instanceof ServletException){
61 Throwable root2 = ((ServletException)rootCause).getRootCause();
62 if(root2!=null){
63 stream.println("------------");
64 stream.println("Root Cause:");
65 stream.println("------------");
66 root2.printStackTrace(stream);
67 }
68 }
69 }
70
71 public void printStackTrace(PrintWriter stream){
72 super.printStackTrace(stream);
73 stream.println("------------");
74 stream.println("Root Cause:");
75 stream.println("------------");
76 rootCause.printStackTrace(stream);
77 if (rootCause instanceof ServletException){
78 Throwable root2 = ((ServletException)rootCause).getRootCause();
79 if(root2!=null){
80 stream.println("------------");
81 stream.println("Root Cause:");
82 stream.println("------------");
83 root2.printStackTrace(stream);
84 }
85 }
86 }
87 }