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