java.util.regex
Class PatternSyntaxException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by java.lang.IllegalArgumentException
                  extended by java.util.regex.PatternSyntaxException
All Implemented Interfaces:
Serializable

public class PatternSyntaxException
extends IllegalArgumentException

Indicates illegal pattern for regular expression. Includes state to inspect the pattern and what and where the expression was not valid regular expression.

Since:
1.4
See Also:
Serialized Form

Constructor Summary
PatternSyntaxException(String description, String pattern, int index)
          Creates a new PatternSyntaxException.
 
Method Summary
 String getDescription()
          Returns a human readable escription of the syntax error.
 int getIndex()
          Returns the index of the first character in the String that was probably invalid, or -1 when unknown.
 String getMessage()
          Returns a string containing a line with the description, a line with the original pattern and a line indicating with a ^ which character is probably the first invalid character in the pattern if the index is not negative.
 String getPattern()
          Returns the original pattern that contained the syntax error.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PatternSyntaxException

public PatternSyntaxException(String description,
                              String pattern,
                              int index)
Creates a new PatternSyntaxException.

Parameters:
description - Human readable escription of the syntax error.
pattern - The original pattern that contained the syntax error.
index - Index of the first character in the String that was probably invalid, or -1 when unknown.
Method Detail

getDescription

public String getDescription()
Returns a human readable escription of the syntax error.


getPattern

public String getPattern()
Returns the original pattern that contained the syntax error.


getIndex

public int getIndex()
Returns the index of the first character in the String that was probably invalid, or -1 when unknown.


getMessage

public String getMessage()
Returns a string containing a line with the description, a line with the original pattern and a line indicating with a ^ which character is probably the first invalid character in the pattern if the index is not negative.

Overrides:
getMessage in class Throwable
Returns:
the error message associated with this Throwable, may be null