KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > datatype > xsd > regex > RegexSyntaxException


1 package com.thaiopensource.datatype.xsd.regex;
2
3 /**
4  * Thrown when an syntactically incorrect regular expression is detected.
5  */

6 public class RegexSyntaxException extends Exception JavaDoc {
7   private final int position;
8
9   /**
10    * Represents an unknown position within a string containing a regular expression.
11    */

12   static public final int UNKNOWN_POSITION = -1;
13
14   public RegexSyntaxException(String JavaDoc detail) {
15     this(detail, UNKNOWN_POSITION);
16   }
17
18   public RegexSyntaxException(String JavaDoc detail, int position) {
19     super(detail);
20     this.position = position;
21   }
22
23   /**
24    * Returns the index into the regular expression where the error was detected
25    * or <code>UNKNOWN_POSITION</code> if this is unknown.
26    *
27    * @return the index into the regular expression where the error was detected,
28    * or <code>UNKNOWNN_POSITION</code> if this is unknown
29    */

30   public int getPosition() {
31     return position;
32   }
33 }
34
Popular Tags