View Javadoc

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 471381 2006-11-05 08:56:58Z wglass $
30   */
31  public class TemplateInitException extends VelocityException 
32          implements ExtendedParseException
33  {
34      private final String templateName;
35      private final int col;
36      private final int line;
37      
38      /**
39       * Version Id for serializable
40       */
41      private static final long serialVersionUID = -4985224672336070621L;
42  
43      public TemplateInitException(final String msg, 
44              final String templateName, final int col, final int line)
45      {
46          super(msg);
47          this.templateName = templateName;
48          this.col = col;
49          this.line = line;
50      }
51  
52      public TemplateInitException(final String msg, ParseException parseException,
53              final String templateName, final int col, final int line)
54      {
55          super(msg,parseException);
56          this.templateName = templateName;
57          this.col = col;
58          this.line = line;
59      }
60  
61      /**
62       * Returns the Template name where this exception occured.
63       * @return the template name
64       */
65      public String getTemplateName()
66      {
67          return templateName;
68      }
69  
70      /**
71       * Returns the line number where this exception occured.
72       * @return the line number
73       */
74      public int getLineNumber()
75      {
76          return line;
77      }
78  
79      /**
80       * Returns the column number where this exception occured.
81       * @return the line number
82       */
83      public int getColumnNumber()
84      {
85          return col;
86      }
87  
88      
89      
90      
91  }