KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.sapia.ubik.rmi;
2
3 import java.io.IOException JavaDoc;
4 import java.io.PrintStream JavaDoc;
5 import java.io.PrintWriter JavaDoc;
6
7
8 /**
9  * @author Yanick Duchesne
10  * <dl>
11  * <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>
12  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
13  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
14  * </dl>
15  */

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

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

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

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

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

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

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

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

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