1 package org.apache.velocity.exception;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.velocity.runtime.parser.ParseException;
23
24 /**
25 * Exception generated to indicate parse errors caught during
26 * directive initialization (e.g. wrong number of arguments)
27 *
28 * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
29 * @version $Id: TemplateInitException.java 685685 2008-08-13 21:43:27Z nbubna $
30 * @since 1.5
31 */
32 public class TemplateInitException extends VelocityException
33 implements ExtendedParseException
34 {
35 private final String templateName;
36 private final int col;
37 private final int line;
38
39 /**
40 * Version Id for serializable
41 */
42 private static final long serialVersionUID = -4985224672336070621L;
43
44 public TemplateInitException(final String msg,
45 final String templateName, final int col, final int line)
46 {
47 super(msg);
48 this.templateName = templateName;
49 this.col = col;
50 this.line = line;
51 }
52
53 public TemplateInitException(final String msg, ParseException parseException,
54 final String templateName, final int col, final int line)
55 {
56 super(msg,parseException);
57 this.templateName = templateName;
58 this.col = col;
59 this.line = line;
60 }
61
62 /**
63 * Returns the Template name where this exception occured.
64 * @return the template name
65 */
66 public String getTemplateName()
67 {
68 return templateName;
69 }
70
71 /**
72 * Returns the line number where this exception occured.
73 * @return the line number
74 */
75 public int getLineNumber()
76 {
77 return line;
78 }
79
80 /**
81 * Returns the column number where this exception occured.
82 * @return the line number
83 */
84 public int getColumnNumber()
85 {
86 return col;
87 }
88
89
90
91
92 }