1 24 package org.objectweb.jalisto.se.exception; 25 26 import java.io.PrintStream ; 27 import java.io.PrintWriter ; 28 29 public class JalistoException extends RuntimeException { 30 public JalistoException() { 31 this.message = ""; 32 this.cause = null; 33 } 34 35 public JalistoException(String s) { 36 this.message = s; 37 this.cause = null; 38 } 39 40 public JalistoException(Throwable t) { 41 this.message = ""; 42 this.cause = t; 43 } 44 45 public JalistoException(String s, Throwable t) { 46 this.message = s; 47 this.cause = t; 48 } 49 50 51 public void printStackTrace() { 52 System.err.println("JalistoException : "+String.valueOf(message)+"\n"); 53 if (cause != null) { 54 System.err.println("internal exception : \n"); 55 cause.printStackTrace(); 56 } 57 } 58 59 public void printStackTrace(PrintStream s) { 60 s.println("JalistoException : "+String.valueOf(message)+"\n"); 61 if (cause != null) { 62 s.println("internal exception : \n"); 63 cause.printStackTrace(s); 64 } 65 } 66 67 public void printStackTrace(PrintWriter s) { 68 s.println("JalistoException : "+String.valueOf(message)+"\n"); 69 if (cause != null) { 70 s.println("internal exception : \n"); 71 cause.printStackTrace(s); 72 } 73 } 74 75 public StackTraceElement [] getStackTrace() { 76 return cause.getStackTrace(); 77 } 78 79 public void setStackTrace(StackTraceElement [] stackTrace) { 80 cause.setStackTrace(stackTrace); 81 } 82 83 public String getLocalizedMessage() { 84 return message; 85 } 86 87 public String getMessage() { 88 return message; 89 } 90 91 public String toString() { 92 return "JalistoException : "+String.valueOf(message); 93 } 94 95 public synchronized Throwable fillInStackTrace() { 96 return super.fillInStackTrace(); 97 } 98 99 public Throwable getCause() { 100 return cause; 101 } 102 103 private String message; 104 private Throwable cause; 105 } 106 | Popular Tags |