aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java/org/apache/velocity/exception/TemplateInitException.java
blob: 20a60ec802fc48c60f812b73208a4a03bcc89748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package org.apache.velocity.exception;

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

import org.apache.velocity.runtime.parser.ParseException;

/**
 * Exception generated to indicate parse errors caught during
 * directive initialization (e.g. wrong number of arguments)
 *
 * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
 * @version $Id$
 * @since 1.5
 */
public class TemplateInitException extends VelocityException
        implements ExtendedParseException
{
    private final String templateName;
    private final int col;
    private final int line;

    /**
     * Version Id for serializable
     */
    private static final long serialVersionUID = -4985224672336070621L;

    /**
     * @param msg
     * @param templateName
     * @param col
     * @param line
     */
    public TemplateInitException(final String msg,
            final String templateName, final int col, final int line)
    {
        super(msg);
        this.templateName = templateName;
        this.col = col;
        this.line = line;
    }

    /**
     *
     * @param msg
     * @param parseException
     * @param templateName
     * @param col
     * @param line
     */
    public TemplateInitException(final String msg, ParseException parseException,
            final String templateName, final int col, final int line)
    {
        super(msg,parseException);
        this.templateName = templateName;
        this.col = col;
        this.line = line;
    }

    /**
     *
     * @param msg
     * @param parseException
     * @param stacktrace
     * @param templateName
     * @param col
     * @param line
     * @since 2.2
     */
    public TemplateInitException(final String msg, ParseException parseException, String[] stacktrace,
                                 final String templateName, final int col, final int line)
    {
        super(msg,parseException, stacktrace);
        this.templateName = templateName;
        this.col = col;
        this.line = line;
    }

    /**
     * Returns the Template name where this exception occurred.
     * @return the template name
     */
    @Override
    public String getTemplateName()
    {
        return templateName;
    }

    /**
     * Returns the line number where this exception occurred.
     * @return the line number
     */
    @Override
    public int getLineNumber()
    {
        return line;
    }

    /**
     * Returns the column number where this exception occurred.
     * @return the line number
     */
    @Override
    public int getColumnNumber()
    {
        return col;
    }




}