1 22 package org.jboss.mq; 23 24 import java.io.PrintStream ; 25 import java.io.PrintWriter ; 26 27 import javax.jms.TransactionRolledBackException ; 28 29 import org.jboss.util.NestedException; 30 import org.jboss.util.NestedThrowable; 31 32 39 public class SpyTransactionRolledBackException extends TransactionRolledBackException implements NestedThrowable 40 { 41 43 44 static final long serialVersionUID = 1764748894215274537L; 45 46 48 49 protected Throwable nested; 50 51 53 55 61 public SpyTransactionRolledBackException(final String msg) 62 { 63 super(msg); 64 this.nested = null; 65 } 66 67 74 public SpyTransactionRolledBackException(final String msg, final Throwable nested) 75 { 76 super(msg); 77 this.nested = nested; 78 NestedThrowable.Util.checkNested(this, nested); 79 } 80 81 87 public SpyTransactionRolledBackException(final Throwable nested) 88 { 89 this(nested.getMessage(), nested); 90 } 91 92 94 96 101 public Throwable getNested() 102 { 103 return nested; 104 } 105 106 108 public Throwable getCause() 109 { 110 return nested; 111 } 112 113 public void setLinkedException(final Exception e) 114 { 115 this.nested = e; 116 } 117 118 public Exception getLinkedException() 119 { 120 if (nested == null) 123 return this; 124 if (nested instanceof Exception ) 125 return (Exception ) nested; 126 return new NestedException(nested); 127 } 128 129 public String getMessage() 130 { 131 return NestedThrowable.Util.getMessage(super.getMessage(), nested); 132 } 133 134 public void printStackTrace(final PrintStream stream) 135 { 136 if (nested == null || NestedThrowable.PARENT_TRACE_ENABLED) 137 super.printStackTrace(stream); 138 NestedThrowable.Util.print(nested, stream); 139 } 140 141 public void printStackTrace(final PrintWriter writer) 142 { 143 if (nested == null || NestedThrowable.PARENT_TRACE_ENABLED) 144 super.printStackTrace(writer); 145 NestedThrowable.Util.print(nested, writer); 146 } 147 148 public void printStackTrace() 149 { 150 printStackTrace(System.err); 151 } 152 153 155 157 159 } | Popular Tags |