1 package net.sourceforge.pmd;
2
3 import java.io.PrintStream;
4 import java.io.PrintWriter;
5
6 /***
7 * A convenience exception wrapper. Contains the original exception, if any. Also, contains
8 * a severity number (int). Zero implies no severity. The higher the number the greater the
9 * severity.
10 *
11 * @author Donald A. Leckie
12 * @since August 30, 2002
13 * @version $Revision: 1.2 $, $Date: 2003/02/24 18:55:30 $
14 */
15 public class PMDException extends Exception {
16
17 private Exception reason;
18 private int severity;
19
20 public PMDException(String message) {
21 super(message);
22 }
23
24 public PMDException(String message, Exception reason) {
25 super(message);
26 this.reason = reason;
27 }
28
29 public void printStackTrace() {
30 printStackTrace(System.err);
31 }
32
33 public void printStackTrace(PrintStream s) {
34 super.printStackTrace(s);
35 if (this.reason != null) {
36 s.print("Caused by: ");
37 this.reason.printStackTrace(s);
38 }
39 }
40
41 public void printStackTrace(PrintWriter s) {
42 super.printStackTrace(s);
43 if (this.reason != null) {
44 s.print("Caused by: ");
45 this.reason.printStackTrace(s);
46 }
47 }
48
49 public Exception getReason() {
50 return reason;
51 }
52
53 public void setSeverity(int severity) {
54 this.severity = severity;
55 }
56
57 public int getSeverity() {
58 return severity;
59 }
60 }
This page was automatically generated by Maven