KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > RemoteRuntimeException


1 package org.sapia.ubik.rmi;
2
3 import java.io.PrintStream JavaDoc;
4 import java.io.PrintWriter JavaDoc;
5
6
7 /**
8  * @author Yanick Duchesne
9  * <dl>
10  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
11  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
12  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
13  * </dl>
14  */

15 public class RemoteRuntimeException extends RuntimeException JavaDoc {
16   /** The source error that is encapsulated in this composite exception. */
17   private Throwable JavaDoc _theSourceError;
18
19   /**
20    * Creates a new CompositeRuntimeException instance with the arguments passed in.
21    *
22    * @param aMessage The message describing the error.
23    * @param aSourceError The source error to encapsulate.
24    */

25   public RemoteRuntimeException(String JavaDoc aMessage, Throwable JavaDoc aSourceError) {
26     super(aMessage);
27     _theSourceError = aSourceError;
28   }
29
30   /**
31    * Creates a new CompositeRuntimeException instance with the argument passed in.
32    *
33    * @param aMessage The message describing the error.
34    */

35   public RemoteRuntimeException(String JavaDoc aMessage) {
36     super(aMessage);
37   }
38
39   /////////////////////////////////////////////////////////////////////////////////////////
40
////////////////////////////////// ACCESSOR METHODS ///////////////////////////////////
41
/////////////////////////////////////////////////////////////////////////////////////////
42

43   /**
44    * Returns the source error encapsulated in this composite exception.
45    *
46    * @return The source error encapsulated in this composite exception.
47    */

48   public Throwable JavaDoc getSourceError() {
49     return _theSourceError;
50   }
51
52   /////////////////////////////////////////////////////////////////////////////////////////
53
////////////////////////////////// OVERRIDEN METHODS //////////////////////////////////
54
/////////////////////////////////////////////////////////////////////////////////////////
55

56   /**
57    * Prints the stack trace of this composite exception to the standard error stream.
58    */

59   public void printStackTrace() {
60     printStackTrace(System.err);
61   }
62
63   /**
64    * Prints the stack trace of this composite exception to the print writer passed in.
65    */

66   public void printStackTrace(PrintWriter JavaDoc anOutput) {
67     super.printStackTrace(anOutput);
68
69     if (_theSourceError != null) {
70       anOutput.print("\n---> NESTED EXCEPTION IS: ");
71       _theSourceError.printStackTrace(anOutput);
72     }
73   }
74
75   /**
76    * Prints the stack trace of this composite exception to the print stream passed in.
77    */

78   public void printStackTrace(PrintStream JavaDoc anOutput) {
79     super.printStackTrace(anOutput);
80
81     if (_theSourceError != null) {
82       anOutput.print("\n---> NESTED EXCEPTION IS: ");
83       _theSourceError.printStackTrace(anOutput);
84     }
85   }
86 }
87
Popular Tags