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.ServiceException</code> is thrown from the
024 * methods in the <code>javax.xml.rpc.Service</code> interface and
025 * <code>ServiceFactory</code> class.
026 *
027 *
028 * @version $Rev: 467553 $ $Date: 2006-10-25 00:01:51 -0400 (Wed, 25 Oct 2006) $
029 */
030 public class ServiceException extends Exception {
031
032 // fixme: could we refactor this to use the jdk1.4 exception wrapping stuff?
033
034 /** The cause of this exception. */
035 Throwable cause;
036
037 /**
038 * Constructs a new exception with <code>null</code> as its
039 * detail message. The cause is not initialized.
040 */
041 public ServiceException() {}
042
043 /**
044 * Constructs a new exception with the specified detail
045 * message. The cause is not initialized.
046 *
047 * @param message The detail message which is later
048 * retrieved using the <code>getMessage</code> method
049 */
050 public ServiceException(String message) {
051 super(message);
052 }
053
054 /**
055 * Constructs a new exception with the specified detail
056 * message and cause.
057 *
058 * @param message the detail message which is later retrieved
059 * using the <code>getMessage</code> method
060 * @param cause the cause which is saved for the later
061 * retrieval throw by the <code>getCause</code>
062 * method
063 */
064 public ServiceException(String message, Throwable cause) {
065 super(message);
066 this.cause = cause;
067 }
068
069 /**
070 * Constructs a new exception with the specified cause
071 * and a detail message of <tt>(cause==null ? null :
072 * cause.toString())</tt> (which typically contains the
073 * class and detail message of <tt>cause</tt>).
074 *
075 * @param cause the cause which is saved for the later
076 * retrieval throw by the getCause method.
077 * (A <tt>null</tt> value is permitted, and
078 * indicates that the cause is nonexistent or
079 * unknown.)
080 */
081 public ServiceException(Throwable cause) {
082 super( (cause == null) ? null : cause.toString() );
083 this.cause = cause;
084 }
085
086 /**
087 * Gets the linked cause.
088 *
089 * @return the cause of this Exception or <code>null</code>
090 * if the cause is noexistent or unknown
091 */
092 public Throwable getLinkedCause() {
093 return cause;
094 }
095
096 }