01: package org.apache.velocity.exception;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "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 471381 2006-11-05 08:56:58Z wglass $
30: */
31: public class TemplateInitException extends VelocityException implements
32: ExtendedParseException {
33: private final String templateName;
34: private final int col;
35: private final int line;
36:
37: /**
38: * Version Id for serializable
39: */
40: private static final long serialVersionUID = -4985224672336070621L;
41:
42: public TemplateInitException(final String msg,
43: final String templateName, final int col, final int line) {
44: super (msg);
45: this .templateName = templateName;
46: this .col = col;
47: this .line = line;
48: }
49:
50: public TemplateInitException(final String msg,
51: ParseException parseException, final String templateName,
52: final int col, final int line) {
53: super (msg, parseException);
54: this .templateName = templateName;
55: this .col = col;
56: this .line = line;
57: }
58:
59: /**
60: * Returns the Template name where this exception occured.
61: * @return the template name
62: */
63: public String getTemplateName() {
64: return templateName;
65: }
66:
67: /**
68: * Returns the line number where this exception occured.
69: * @return the line number
70: */
71: public int getLineNumber() {
72: return line;
73: }
74:
75: /**
76: * Returns the column number where this exception occured.
77: * @return the line number
78: */
79: public int getColumnNumber() {
80: return col;
81: }
82:
83: }
|