KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jasper > compiler > JavacErrorDetail


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

17
18 package org.apache.jasper.compiler;
19
20 /**
21  * Class providing details about a javac compilation error.
22  *
23  * @author Jan Luehe
24  * @author Kin-man Chung
25  */

26 public class JavacErrorDetail {
27
28     private String JavaDoc javaFileName;
29     private int javaLineNum;
30     private String JavaDoc jspFileName;
31     private int jspBeginLineNum;
32     private StringBuffer JavaDoc errMsg;
33
34     /**
35      * Constructor.
36      *
37      * @param javaFileName The name of the Java file in which the
38      * compilation error occurred
39      * @param javaLineNum The compilation error line number
40      * @param errMsg The compilation error message
41      */

42     public JavacErrorDetail(String JavaDoc javaFileName,
43                 int javaLineNum,
44                 StringBuffer JavaDoc errMsg) {
45
46     this.javaFileName = javaFileName;
47     this.javaLineNum = javaLineNum;
48     this.errMsg = errMsg;
49         this.jspBeginLineNum = -1;
50     }
51
52     /**
53      * Constructor.
54      *
55      * @param javaFileName The name of the Java file in which the
56      * compilation error occurred
57      * @param javaLineNum The compilation error line number
58      * @param jspFileName The name of the JSP file from which the Java source
59      * file was generated
60      * @param jspBeginLineNum The start line number of the JSP element
61      * responsible for the compilation error
62      * @param errMsg The compilation error message
63      */

64     public JavacErrorDetail(String JavaDoc javaFileName,
65                 int javaLineNum,
66                 String JavaDoc jspFileName,
67                 int jspBeginLineNum,
68                 StringBuffer JavaDoc errMsg) {
69
70         this(javaFileName, javaLineNum, errMsg);
71     this.jspFileName = jspFileName;
72     this.jspBeginLineNum = jspBeginLineNum;
73     }
74
75     /**
76      * Gets the name of the Java source file in which the compilation error
77      * occurred.
78      *
79      * @return Java source file name
80      */

81     public String JavaDoc getJavaFileName() {
82     return this.javaFileName;
83     }
84
85     /**
86      * Gets the compilation error line number.
87      *
88      * @return Compilation error line number
89      */

90     public int getJavaLineNumber() {
91     return this.javaLineNum;
92     }
93
94     /**
95      * Gets the name of the JSP file from which the Java source file was
96      * generated.
97      *
98      * @return JSP file from which the Java source file was generated.
99      */

100     public String JavaDoc getJspFileName() {
101     return this.jspFileName;
102     }
103
104     /**
105      * Gets the start line number (in the JSP file) of the JSP element
106      * responsible for the compilation error.
107      *
108      * @return Start line number of the JSP element responsible for the
109      * compilation error
110      */

111     public int getJspBeginLineNumber() {
112     return this.jspBeginLineNum;
113     }
114
115     /**
116      * Gets the compilation error message.
117      *
118      * @return Compilation error message
119      */

120     public String JavaDoc getErrorMessage() {
121     return this.errMsg.toString();
122     }
123 }
124
Popular Tags