KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > common > NamespaceException


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/NamespaceException.java,v 1.7 2004/07/28 09:38:17 ib Exp $
3  * $Revision: 1.7 $
4  * $Date: 2004/07/28 09:38:17 $
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.common;
25
26 import java.util.Vector JavaDoc;
27 import java.util.Enumeration JavaDoc;
28
29 /**
30  * Namespace exception.
31  *
32  * @version $Revision: 1.7 $
33  */

34 public class NamespaceException extends SlideException {
35     
36     
37     // ------------------------------------------------------------ Constructor
38

39     
40     /**
41      * Constructor.
42      *
43      * @param message Exception message
44      */

45     public NamespaceException(String JavaDoc message) {
46         super(message, false);
47         exceptions = new Vector JavaDoc();
48     }
49     
50     
51     // ----------------------------------------------------- Instance Variables
52

53     
54     /**
55      * Vector of exceptions which have been put in this exception.
56      */

57     private Vector JavaDoc exceptions;
58     
59     
60     // --------------------------------------------------------- Public Methods
61

62     
63     /**
64      * Displays the exception message.
65      *
66      * @return String Message
67      */

68     public String JavaDoc toString() {
69         String JavaDoc result = new String JavaDoc();
70         if( exceptions != null ) {
71             Enumeration JavaDoc list = exceptions.elements();
72             while (list.hasMoreElements()) {
73                 SlideException e = (SlideException) list.nextElement();
74                 result = result + e.getMessage() + "\n";
75             }
76         }
77         return result;
78     }
79     
80     
81     // -------------------------------------------------------- Package Methods
82

83     
84     /**
85      * Add an exception to the nested exception.
86      *
87      * @param exception Exception to be added
88      */

89     void addException(SlideException exception) {
90         exceptions.addElement(exception);
91     }
92     
93     
94     /**
95      * Returns true if no exceptions have been put in this exception.
96      *
97      * @return boolean
98      */

99     boolean isEmpty() {
100         return exceptions.isEmpty();
101     }
102     
103 }
104
Popular Tags