1 28 29 30 package org.objectweb.jonas_lib.deployment.api; 31 32 import java.io.PrintStream ; 33 import java.io.PrintWriter ; 34 35 42 public class DeploymentDescException extends Exception { 43 44 47 private Throwable cause; 48 49 52 public DeploymentDescException() { 53 super(); 54 cause = null; 55 } 56 57 58 63 public DeploymentDescException(String msg) { 64 super(msg); 65 cause = null; 66 } 67 68 75 public DeploymentDescException(String msg, 76 Throwable cause) { 77 super(msg); 78 this.cause = cause; 79 } 80 81 88 public DeploymentDescException(Throwable cause) { 89 super(cause.getMessage()); 90 this.cause = cause; 91 } 92 93 97 public String getMessage() { 98 String msg = super.getMessage(); 99 if (cause == null) { 100 return msg; 101 } else { 102 return msg + ": " + cause.getMessage(); 103 } 104 } 105 106 110 public Throwable getCause() { 111 return cause; 112 } 113 114 118 public void printStackTrace() { 119 super.printStackTrace(); 120 if (cause != null) { 121 System.err.println(); 122 System.err.println("*** Caused by:"); 123 cause.printStackTrace(); 124 } 125 } 126 127 132 public void printStackTrace(PrintStream s) { 133 super.printStackTrace(s); 134 if (cause != null) { 135 s.println(); 136 s.println ("*** Caused by:"); 137 cause.printStackTrace(s); 138 } 139 } 140 141 146 public void printStackTrace(PrintWriter s) { 147 super.printStackTrace(s); 148 if (cause != null) { 149 s.println(); 150 s.println("*** Caused by:"); 151 cause.printStackTrace(s); 152 } 153 } 154 } 155 | Popular Tags |