View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.jsp.ast;
5   
6   /**
7    * @author Pieter_Van_Raemdonck
8    * @since Created on 11-jan-2006
9    */
10  public class StartAndEndTagMismatchException extends SyntaxErrorException {
11  
12      private static final long serialVersionUID = 5434485938487458692L;
13  
14      public static final String START_END_TAG_MISMATCH_RULE_NAME
15              = "Start and End Tags of an XML Element must match.";
16  
17      private int startLine, endLine, startColumn, endColumn;
18      private String startTagName, endTagName;
19  
20      /**
21       * Public constructor.
22       *
23       * @param startLine
24       * @param startColumn
25       * @param startTagName
26       * @param endLine
27       * @param endColumn
28       * @param endTagName
29       */
30      public StartAndEndTagMismatchException(int startLine, int startColumn, String startTagName,
31                                             int endLine, int endColumn, String endTagName) {
32          super(endLine, START_END_TAG_MISMATCH_RULE_NAME);
33          this.startLine = startLine;
34          this.startColumn = startColumn;
35          this.startTagName = startTagName;
36  
37          this.endLine = endLine;
38          this.endColumn = endColumn;
39          this.endTagName = endTagName;
40      }
41  
42  
43      /**
44       * @return Returns the endColumn.
45       */
46      public int getEndColumn() {
47          return endColumn;
48      }
49  
50      /**
51       * @return Returns the endLine.
52       */
53      public int getEndLine() {
54          return endLine;
55      }
56  
57      /**
58       * @return Returns the startColumn.
59       */
60      public int getStartColumn() {
61          return startColumn;
62      }
63  
64      /**
65       * @return Returns the startLine.
66       */
67      public int getStartLine() {
68          return startLine;
69      }
70  
71      /* (non-Javadoc)
72       * @see java.lang.Throwable#getMessage()
73       */
74      public String getMessage() {
75          return "The start-tag of element \"" + startTagName + "\" (line "
76                  + startLine + ", column " + startColumn
77                  + ") does not correspond to the end-tag found: \""
78                  + endTagName + "\" (line " + endLine
79                  + ", column " + endColumn + ").";
80      }
81  }