KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > uddi4j > transport > TransportException


1 /*
2  * The source code contained herein is licensed under the IBM Public License
3  * Version 1.0, which has been approved by the Open Source Initiative.
4  * Copyright (C) 2001, International Business Machines Corporation
5  * All Rights Reserved.
6  *
7  */

8
9 package org.uddi4j.transport;
10
11 /**
12  * Represents a communications error originating
13  * within the SOAP transport. The native exception
14  * thrown by the SOAP transport is encapsulated
15  * within this exception.
16  *
17  * @author David Melgar (dmelgar@us.ibm.com)
18  */

19 public class TransportException extends Exception JavaDoc {
20    Exception JavaDoc nativeException = null;
21
22    /**
23     * Constructs an <code>TransportException</code> with no specified detail message.
24     */

25    public TransportException() {
26        super();
27    }
28
29    /**
30     * Constructs a <code>TransportException</code> with the specified detail message.
31     *
32     * @param s the detail message.
33     */

34    public TransportException(String JavaDoc s) {
35        super(s);
36    }
37
38    /**
39     * Constructs a <code>TransportException</code> wrappering the native transport
40     * exception.
41     *
42     * @param e Native exception to be wrappered
43     */

44    public TransportException(Exception JavaDoc e) {
45       super(e.getMessage());
46       nativeException = e;
47    }
48
49    /**
50     * Returns the native transport exception wrappered
51     * by this class.
52     *
53     * @return Exception
54     */

55    public Exception JavaDoc getException() {
56       return nativeException;
57    }
58
59
60    /**
61     * Prints this <code>Throwable</code> and its backtrace to the
62     * specified print stream as well as the wrappered exception.
63     */

64    public void printStackTrace() {
65       printStackTrace(System.err);
66    }
67
68    /**
69     * Prints this <code>Throwable</code> and its backtrace to the
70     * specified print stream as well as the wrappered exception.
71     *
72     * @param s <code>PrintStream</code> to use for output
73     */

74    public void printStackTrace(java.io.PrintStream JavaDoc s) {
75       super.printStackTrace(s);
76       if (nativeException != null) {
77          s.println("\nNested exception:");
78          nativeException.printStackTrace(s);
79       }
80    }
81 }
82
Popular Tags