1 4 package net.sourceforge.pmd; 5 6 import java.io.PrintStream ; 7 import java.io.PrintWriter ; 8 9 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 } | Popular Tags |