View Javadoc

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