KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > util > conf > ConfigurationException


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/conf/ConfigurationException.java,v 1.5 2004/07/28 09:34:23 ib Exp $
3  * $Revision: 1.5 $
4  * $Date: 2004/07/28 09:34:23 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.util.conf;
25
26 /**
27  * Thrown when a <code>Configurable</code> component cannot be configured
28  * properly, or if a value cannot be retrieved properly.
29  *
30  * @version CVS $Revision: 1.5 $ $Date: 2004/07/28 09:34:23 $
31  */

32 public class ConfigurationException extends RuntimeException JavaDoc {
33
34     /** The current configuration */
35     private Configuration configuration=null;
36
37     /**
38      * Construct a new <code>ConfigurationException</code> instance.
39      *
40      * @param message The detail message for this exception (mandatory).
41      * @param conf The configuration element.
42      */

43     public ConfigurationException(String JavaDoc message, Configuration conf) {
44         super(message);
45         this.configuration=conf;
46     }
47
48     /**
49      * Get the <code>Configuration</code> element.
50      *
51      * @return <code>Configuration</code> element associated, or
52      * <code>null</code> if there is none.
53      */

54     public Configuration getConfiguration() {
55         return (this.configuration);
56     }
57
58     /**
59      * Return this <code>ConfigurationException</code> (if possible with
60      * location information).
61      */

62     public String JavaDoc getMessage() {
63         String JavaDoc msg=super.getMessage();
64
65         if (this.configuration!=null) {
66             msg = msg + " @ " + this.configuration.getLocation();
67         }
68
69         return(msg);
70     }
71 }
72
Popular Tags