001    /*
002     * Copyright 2001-2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package javax.xml.rpc;
017    
018    /**
019     * The <code>javax.xml.rpc.JAXRPCException</code> is thrown from
020     * the core JAX-RPC APIs to indicate an exception related to the
021     * JAX-RPC runtime mechanisms.
022     *
023     * @version 1.0
024     */
025    public class JAXRPCException extends RuntimeException {
026    
027        // fixme: Why doesn't this use the jdk1.4 exception wrapping APIs?
028    
029        /** The cause of this error. */
030        Throwable cause;
031        
032        /**
033         * Constructs a new exception with <code>null</code> as its
034         * detail message. The cause is not initialized.
035         */
036        public JAXRPCException() {}
037        
038        /**
039         * Constructs a new exception with the specified detail
040         * message.  The cause is not initialized.
041         *
042         * @param message The detail message which is later
043         *            retrieved using the getMessage method
044         */
045        public JAXRPCException(String message) {
046            super(message);
047        }
048        
049        /**
050         * Constructs a new exception with the specified detail
051         * message and cause.
052         *
053         * @param message The detail message which is later retrieved
054         *            using the getMessage method
055         * @param cause The cause which is saved for the later
056         *            retrieval throw by the getCause method
057         */
058        public JAXRPCException(String message, Throwable cause) {
059            super(message);
060            this.cause = cause;
061        }
062        
063        /**
064         * Constructs a new JAXRPCException with the specified cause
065         * and a detail message of <tt>(cause==null ? null :
066         * cause.toString())</tt> (which typically contains the
067         * class and detail message of <tt>cause</tt>).
068         *
069         * @param cause The cause which is saved for the later
070         *            retrieval throw by the getCause method.
071         *            (A <tt>null</tt> value is permitted, and
072         *            indicates that the cause is nonexistent or
073         *          unknown.)
074         */
075        public JAXRPCException(Throwable cause) {
076            super( (cause == null) ? null : cause.toString() );
077            this.cause = cause;
078        }
079        
080        /**
081         * Gets the linked cause.
082         *
083         * @return The cause of this Exception or <code>null</code>
084         *     if the cause is noexistent or unknown
085         */
086        public Throwable getLinkedCause() {
087            return cause;
088        }
089        
090    }