KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xalan > internal > xsltc > compiler > util > TypeCheckError


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: TypeCheckError.java,v 1.7 2004/02/16 22:26:44 minchau Exp $
18  */

19
20 package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
21
22 import com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode;
23
24 /**
25  * @author Jacek Ambroziak
26  * @author Santiago Pericas-Geertsen
27  */

28 public class TypeCheckError extends Exception JavaDoc {
29     ErrorMsg _error = null;
30     SyntaxTreeNode _node = null;
31     
32     public TypeCheckError(SyntaxTreeNode node) {
33     super();
34     _node = node;
35     }
36
37     public TypeCheckError(ErrorMsg error) {
38     super();
39     _error = error;
40     }
41     
42     public TypeCheckError(String JavaDoc code, Object JavaDoc param) {
43     super();
44     _error = new ErrorMsg(code, param);
45     }
46
47     public TypeCheckError(String JavaDoc code, Object JavaDoc param1, Object JavaDoc param2) {
48     super();
49     _error = new ErrorMsg(code, param1, param2);
50     }
51
52     public ErrorMsg getErrorMsg() {
53         return _error;
54     }
55
56     public String JavaDoc getMessage() {
57         return toString();
58     }
59
60     public String JavaDoc toString() {
61     String JavaDoc result;
62
63     if (_error == null) {
64             if (_node != null) {
65                 _error = new ErrorMsg(ErrorMsg.TYPE_CHECK_ERR,
66                                       _node.toString());
67         } else {
68             _error = new ErrorMsg(ErrorMsg.TYPE_CHECK_UNK_LOC_ERR);
69         }
70         }
71
72     return _error.toString();
73     }
74 }
75
Popular Tags