KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > languages > ParseException


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.api.languages;
21
22
23 /**
24  * Parse Exception.
25  *
26  * @author Jan Jancura
27  */

28 public class ParseException extends Exception JavaDoc {
29        
30     private ASTNode node;
31
32     
33     /**
34      * Creates a new instance of ParseException.
35      */

36     public ParseException () {}
37     
38     /**
39      * Creates a new instance of ParseException with given error message.
40      *
41      * @param text a text of message
42      */

43     public ParseException (String JavaDoc text) {
44         super (text);
45     }
46     
47     /**
48      * Creates a new instance of ParseException encapsulating some other Exception.
49      *
50      * @param ex an internal exception
51      */

52     public ParseException (Exception JavaDoc ex) {
53         super (ex);
54         if (ex instanceof ParseException)
55             node = ((ParseException) ex).getASTNode ();
56     }
57     
58     /**
59      * Creates a new instance of ParseException with given error message and AST tree.
60      *
61      * @param text a text of message
62      * @param root a root of AST tree
63      */

64     public ParseException (String JavaDoc text, ASTNode root) {
65         super (text);
66         this.node = root;
67     }
68     
69     /**
70      * Creates a new instance of ParseException with given exception and AST tree.
71      *
72      * @param ex an internal exception
73      * @param root a root of AST tree
74      */

75     public ParseException (Exception JavaDoc ex, ASTNode root) {
76         super (ex);
77         this.node = root;
78     }
79
80     /**
81      * Returns root of AST tree.
82      *
83      * @return a root of AST tree
84      */

85     public ASTNode getASTNode () {
86         return node;
87     }
88 }
89
90
Popular Tags