1 45 package org.exolab.jms.net.connector; 46 47 import java.io.PrintStream ; 48 import java.io.PrintWriter ; 49 50 51 57 public class ResourceException extends Exception { 58 59 62 private Throwable _target; 63 64 67 private static final long serialVersionUID = 1L; 68 69 70 73 public ResourceException() { 74 } 75 76 81 public ResourceException(String detail) { 82 super(detail); 83 } 84 85 90 public ResourceException(Throwable target) { 91 _target = target; 92 } 93 94 101 public ResourceException(String detail, Throwable target) { 102 super(detail); 103 _target = target; 104 } 105 106 111 public Throwable getTargetException() { 112 return _target; 113 } 114 115 121 public void printStackTrace(PrintStream stream) { 122 synchronized (stream) { 123 if (_target != null) { 124 stream.print(getClass().getName() + ": "); 125 _target.printStackTrace(stream); 126 } else { 127 super.printStackTrace(stream); 128 } 129 } 130 } 131 132 138 public void printStackTrace(PrintWriter writer) { 139 synchronized (writer) { 140 if (_target != null) { 141 writer.print(getClass().getName() + ": "); 142 _target.printStackTrace(writer); 143 } else { 144 super.printStackTrace(writer); 145 } 146 } 147 } 148 149 } 150 | Popular Tags |