001 /*
002 * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
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 org.osgi.service.http;
017
018 /**
019 * A NamespaceException is thrown to indicate an error with the caller's request
020 * to register a servlet or resources into the URI namespace of the Http
021 * Service. This exception indicates that the requested alias already is in use.
022 *
023 * @version $Revision: 6083 $
024 */
025 public class NamespaceException extends Exception {
026 static final long serialVersionUID = 7235606031147877747L;
027
028 /**
029 * Construct a <code>NamespaceException</code> object with a detail message.
030 *
031 * @param message the detail message
032 */
033 public NamespaceException(String message) {
034 super(message);
035 }
036
037 /**
038 * Construct a <code>NamespaceException</code> object with a detail message
039 * and a nested exception.
040 *
041 * @param message The detail message.
042 * @param cause The nested exception.
043 */
044 public NamespaceException(String message, Throwable cause) {
045 super(message, cause);
046 }
047
048 /**
049 * Returns the nested exception.
050 *
051 * <p>
052 * This method predates the general purpose exception chaining mechanism.
053 * The <code>getCause()</code> method is now the preferred means of
054 * obtaining this information.
055 *
056 * @return The result of calling <code>getCause()</code>.
057 */
058 public Throwable getException() {
059 return getCause();
060 }
061
062 /**
063 * Returns the cause of this exception or <code>null</code> if no cause was
064 * set.
065 *
066 * @return The cause of this exception or <code>null</code> if no cause was
067 * set.
068 * @since 1.2
069 */
070 public Throwable getCause() {
071 return super.getCause();
072 }
073
074 /**
075 * Initializes the cause of this exception to the specified value.
076 *
077 * @param cause The cause of this exception.
078 * @return This exception.
079 * @throws IllegalArgumentException If the specified cause is this
080 * exception.
081 * @throws IllegalStateException If the cause of this exception has already
082 * been set.
083 * @since 1.2
084 */
085 public Throwable initCause(Throwable cause) {
086 return super.initCause(cause);
087 }
088 }