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