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 javax.ejb.TransactionRolledbackLocalException;
027: import javax.transaction.RollbackException;
028: import org.jboss.util.NestedThrowable;
029:
030: /**
031: * JBossTransactionRolledbackLocalException.java
032: *
033: * Created: Sun Feb 9 22:45:03 2003
034: *
035: * @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
036: * @version
037: */
038: public class JBossTransactionRolledbackLocalException extends
039: TransactionRolledbackLocalException implements NestedThrowable {
040: public JBossTransactionRolledbackLocalException() {
041: super ();
042: }
043:
044: public JBossTransactionRolledbackLocalException(final Exception e) {
045: super (null, e);
046: }
047:
048: public JBossTransactionRolledbackLocalException(final String message) {
049: super (message);
050: }
051:
052: public JBossTransactionRolledbackLocalException(
053: final String message, final Exception e) {
054: super (message, e);
055: }
056:
057: // Implementation of org.jboss.util.NestedThrowable
058:
059: public Throwable getNested() {
060: return getCausedByException();
061: }
062:
063: public Throwable getCause() {
064: return getCausedByException();
065: }
066:
067: /**
068: * Returns the composite throwable message.
069: *
070: * @return The composite throwable message.
071: */
072: public String getMessage() {
073: return NestedThrowable.Util.getMessage(super .getMessage(),
074: getCausedByException());
075: }
076:
077: /**
078: * Prints the composite message and the embedded stack trace to the
079: * specified print stream.
080: *
081: * @param stream Stream to print to.
082: */
083: public void printStackTrace(final PrintStream stream) {
084: if (getCausedByException() == null
085: || NestedThrowable.PARENT_TRACE_ENABLED) {
086: super .printStackTrace(stream);
087: }
088: NestedThrowable.Util.print(getCausedByException(), stream);
089: }
090:
091: /**
092: * Prints the composite message and the embedded stack trace to the
093: * specified print writer.
094: *
095: * @param writer Writer to print to.
096: */
097: public void printStackTrace(final PrintWriter writer) {
098: if (getCausedByException() == null
099: || NestedThrowable.PARENT_TRACE_ENABLED) {
100: super .printStackTrace(writer);
101: }
102: NestedThrowable.Util.print(getCausedByException(), writer);
103: }
104:
105: /**
106: * Prints the composite message and the embedded stack trace to
107: * <tt>System.err</tt>.
108: */
109: public void printStackTrace() {
110: printStackTrace(System.err);
111: }
112:
113: }// JBossTransactionRolledbackLocalException
|