001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.tm;
023:
024: import java.io.PrintStream;
025: import java.io.PrintWriter;
026: import java.io.Serializable;
027: import javax.transaction.RollbackException;
028: import javax.transaction.TransactionRolledbackException;
029: import org.jboss.util.NestedThrowable;
030:
031: /**
032: * JBossTransactionRolledbackException.java
033: *
034: *
035: * Created: Sun Feb 9 22:45:03 2003
036: *
037: * @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
038: * @version
039: */
040:
041: public class JBossTransactionRolledbackException extends
042: TransactionRolledbackException implements NestedThrowable,
043: Serializable {
044: static final long serialVersionUID = -7898523359306778506L;
045:
046: public JBossTransactionRolledbackException() {
047: super ();
048: }
049:
050: public JBossTransactionRolledbackException(final String message) {
051: super (message);
052: }
053:
054: public JBossTransactionRolledbackException(final Throwable t) {
055: super ();
056: this .detail = t;
057: }
058:
059: public JBossTransactionRolledbackException(final String message,
060: final Throwable t) {
061: super (message);
062: this .detail = t;
063: }
064:
065: // Implementation of org.jboss.util.NestedThrowable
066:
067: public Throwable getNested() {
068: return detail;
069: }
070:
071: public Throwable getCause() {
072: return detail;
073: }
074:
075: /**
076: * Returns the composite throwable message.
077: *
078: * @return The composite throwable message.
079: */
080: public String getMessage() {
081: return NestedThrowable.Util.getMessage(super .getMessage(),
082: detail);
083: }
084:
085: /**
086: * Prints the composite message and the embedded stack trace to the
087: * specified print stream.
088: *
089: * @param stream Stream to print to.
090: */
091: public void printStackTrace(final PrintStream stream) {
092: if (detail == null || NestedThrowable.PARENT_TRACE_ENABLED) {
093: super .printStackTrace(stream);
094: }
095: NestedThrowable.Util.print(detail, stream);
096: }
097:
098: /**
099: * Prints the composite message and the embedded stack trace to the
100: * specified print writer.
101: *
102: * @param writer Writer to print to.
103: */
104: public void printStackTrace(final PrintWriter writer) {
105: if (detail == null || NestedThrowable.PARENT_TRACE_ENABLED) {
106: super .printStackTrace(writer);
107: }
108: NestedThrowable.Util.print(detail, writer);
109: }
110:
111: /**
112: * Prints the composite message and the embedded stack trace to
113: * <tt>System.err</tt>.
114: */
115: public void printStackTrace() {
116: printStackTrace(System.err);
117: }
118:
119: }// JBossTransactionRolledbackException
|