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      public static final String START_END_TAG_MISMATCH_RULE_NAME
13              = "Start and End Tags of an XML Element must match.";
14  
15      private int startLine, endLine, startColumn, endColumn;
16      private String startTagName, endTagName;
17  
18      /**
19       * Public constructor.
20       *
21       * @param startLine
22       * @param startColumn
23       * @param startTagName
24       * @param endLine
25       * @param endColumn
26       * @param endTagName
27       */
28      public StartAndEndTagMismatchException(int startLine, int startColumn, String startTagName,
29                                             int endLine, int endColumn, String endTagName) {
30          super(endLine, START_END_TAG_MISMATCH_RULE_NAME);
31          this.startLine = startLine;
32          this.startColumn = startColumn;
33          this.startTagName = startTagName;
34  
35          this.endLine = endLine;
36          this.endColumn = endColumn;
37          this.endTagName = endTagName;
38      }
39  
40  
41      /**
42       * @return Returns the endColumn.
43       */
44      public int getEndColumn() {
45          return endColumn;
46      }
47  
48      /**
49       * @return Returns the endLine.
50       */
51      public int getEndLine() {
52          return endLine;
53      }
54  
55      /**
56       * @return Returns the startColumn.
57       */
58      public int getStartColumn() {
59          return startColumn;
60      }
61  
62      /**
63       * @return Returns the startLine.
64       */
65      public int getStartLine() {
66          return startLine;
67      }
68  
69      /* (non-Javadoc)
70       * @see java.lang.Throwable#getMessage()
71       */
72      public String getMessage() {
73          return "The start-tag of element \"" + startTagName + "\" (line "
74                  + startLine + ", column " + startColumn
75                  + ") does not correspond to the end-tag found: \""
76                  + endTagName + "\" (line " + endLine
77                  + ", column " + endColumn + ").";
78      }
79  }