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.mx.util;
023:
024: import javax.management.NotCompliantMBeanException;
025: import java.io.PrintStream;
026: import java.io.PrintWriter;
027:
028: /**
029: * JBossNotCompliantMBeanException.java
030: *
031: *
032: * Created: Tues Feb 18 22:45:03 2003
033: *
034: * @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
035: * @version $Revision: 57200 $
036: */
037:
038: public class JBossNotCompliantMBeanException extends
039: NotCompliantMBeanException {
040: private static final long serialVersionUID = 7441880585611238427L;
041:
042: private final Throwable t;
043:
044: public JBossNotCompliantMBeanException() {
045: super ();
046: t = null;
047: }
048:
049: public JBossNotCompliantMBeanException(String message) {
050: super (message);
051: t = null;
052: }
053:
054: public JBossNotCompliantMBeanException(Throwable t) {
055: super ();
056: this .t = t;
057: }
058:
059: public JBossNotCompliantMBeanException(String message, Throwable t) {
060: super (message);
061: this .t = t;
062: }
063:
064: // Implementation of org.jboss.util.NestedThrowable
065:
066: public Throwable getNested() {
067: return t;
068: }
069:
070: public Throwable getCause() {
071: return t;
072: }
073:
074: /**
075: * Returns the composite throwable message.
076: *
077: * @return The composite throwable message.
078: */
079: public String getMessage() {
080: //return NestedThrowable.Util.getMessage(super.getMessage(), t);
081: return super .getMessage();
082: }
083:
084: /**
085: * Prints the composite message and the embedded stack trace to the
086: * specified print stream.
087: *
088: * @param stream Stream to print to.
089: */
090: public void printStackTrace(final PrintStream stream) {
091: //if (t == null || NestedThrowable.PARENT_TRACE_ENABLED)
092: {
093: super .printStackTrace(stream);
094: }
095: //NestedThrowable.Util.print(t, 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 (t == null || NestedThrowable.PARENT_TRACE_ENABLED)
106: {
107: super .printStackTrace(writer);
108: }
109: //NestedThrowable.Util.print(t, writer);
110: }
111:
112: /**
113: * Prints the composite message and the embedded stack trace to
114: * <tt>System.err</tt>.
115: */
116: public void printStackTrace() {
117: printStackTrace(System.err);
118: }
119:
120: }// JBossNotCompliantMBeanException
|