KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tax > TreeException


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.tax;
21
22 /**
23  * All exceptions in tree are by default unchecked so they must be
24  * declared in method signature if they should behave as checked exceptions.
25  * <p>
26  * At many places it is accurate just mention in JavaDoc that the method
27  * may throw it (if passing the right value is at callee reponsibility).
28  * It must be declared just at places where callee can not explicitly
29  * guarantee that the exception will not occure so it must check for it.
30  * <p>
31  * It is a folding exception.
32  *
33  * @author Libor Kramolis
34  */

35 public class TreeException extends Exception JavaDoc {
36     
37     /** Serial Version UID */
38     private static final long serialVersionUID =1949769568282926780L;
39     
40     //
41
// init
42
//
43

44     /** Create new TreeException. */
45     public TreeException (String JavaDoc msg, Exception JavaDoc exception) {
46         super (msg);
47         if (exception != null) {
48             initCause(exception);
49         }
50     }
51     
52     
53     /** Creates new TreeException with specified detail message.
54      * @param msg detail message
55      */

56     public TreeException (String JavaDoc msg) {
57         this (msg, null);
58     }
59     
60     
61     /** Creates new TreeException with specified encapsulated exception.
62      * @param exc encapsulated exception
63      */

64     public TreeException (Exception JavaDoc exc) {
65         this(exc.toString(), exc);
66     }
67     
68     
69     //
70
// itself
71
//
72

73     /** Get the encapsulated exception.
74      * @return encapsulated encapsulated
75      */

76     public Exception JavaDoc getException () {
77         return (Exception JavaDoc) getCause();
78     }
79
80 }
81
Popular Tags