KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > http > NamespaceException


1 /*
2  * $Header: /cvshome/build/org.osgi.service.http/src/org/osgi/service/http/NamespaceException.java,v 1.11 2006/07/11 13:15:56 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.osgi.service.http;
19
20 /**
21  * A NamespaceException is thrown to indicate an error with the caller's request
22  * to register a servlet or resources into the URI namespace of the Http
23  * Service. This exception indicates that the requested alias already is in use.
24  *
25  * @version $Revision: 1.11 $
26  */

27 public class NamespaceException extends Exception JavaDoc {
28     static final long serialVersionUID = 7235606031147877747L;
29     /**
30      * Nested exception.
31      */

32     private final Throwable JavaDoc cause;
33
34     /**
35      * Construct a <code>NamespaceException</code> object with a detail message.
36      *
37      * @param message the detail message
38      */

39     public NamespaceException(String JavaDoc message) {
40         super(message);
41         cause = null;
42     }
43
44     /**
45      * Construct a <code>NamespaceException</code> object with a detail message
46      * and a nested exception.
47      *
48      * @param message The detail message.
49      * @param cause The nested exception.
50      */

51     public NamespaceException(String JavaDoc message, Throwable JavaDoc cause) {
52         super(message);
53         this.cause = cause;
54     }
55
56     /**
57      * Returns the nested exception.
58      *
59      * <p>This method predates the general purpose exception chaining mechanism.
60      * The {@link #getCause()} method is now the preferred means of
61      * obtaining this information.
62      *
63      * @return the nested exception or <code>null</code> if there is no nested
64      * exception.
65      */

66     public Throwable JavaDoc getException() {
67         return cause;
68     }
69
70     /**
71      * Returns the cause of this exception or <code>null</code> if no
72      * cause was specified when this exception was created.
73      *
74      * @return The cause of this exception or <code>null</code> if no
75      * cause was specified.
76      * @since 1.2
77      */

78     public Throwable JavaDoc getCause() {
79         return cause;
80     }
81
82     /**
83      * The cause of this exception can only be set when constructed.
84      *
85      * @param cause Cause of the exception.
86      * @return This object.
87      * @throws java.lang.IllegalStateException
88      * This method will always throw an <code>IllegalStateException</code>
89      * since the cause of this exception can only be set when constructed.
90      * @since 1.2
91      */

92     public Throwable JavaDoc initCause(Throwable JavaDoc cause) {
93         throw new IllegalStateException JavaDoc();
94     }
95 }
96
Popular Tags