< prev index next >

src/java.base/share/classes/java/util/regex/PatternSyntaxException.java

Print this page




  40 public class PatternSyntaxException
  41     extends IllegalArgumentException
  42 {
  43     private static final long serialVersionUID = -3864639126226059218L;
  44 
  45     private final String desc;
  46     private final String pattern;
  47     private final int index;
  48 
  49     /**
  50      * Constructs a new instance of this class.
  51      *
  52      * @param  desc
  53      *         A description of the error
  54      *
  55      * @param  regex
  56      *         The erroneous pattern
  57      *
  58      * @param  index
  59      *         The approximate index in the pattern of the error,
  60      *         or <tt>-1</tt> if the index is not known
  61      */
  62     public PatternSyntaxException(String desc, String regex, int index) {
  63         this.desc = desc;
  64         this.pattern = regex;
  65         this.index = index;
  66     }
  67 
  68     /**
  69      * Retrieves the error index.
  70      *
  71      * @return  The approximate index in the pattern of the error,
  72      *         or <tt>-1</tt> if the index is not known
  73      */
  74     public int getIndex() {
  75         return index;
  76     }
  77 
  78     /**
  79      * Retrieves the description of the error.
  80      *
  81      * @return  The description of the error
  82      */
  83     public String getDescription() {
  84         return desc;
  85     }
  86 
  87     /**
  88      * Retrieves the erroneous regular-expression pattern.
  89      *
  90      * @return  The erroneous pattern
  91      */
  92     public String getPattern() {




  40 public class PatternSyntaxException
  41     extends IllegalArgumentException
  42 {
  43     private static final long serialVersionUID = -3864639126226059218L;
  44 
  45     private final String desc;
  46     private final String pattern;
  47     private final int index;
  48 
  49     /**
  50      * Constructs a new instance of this class.
  51      *
  52      * @param  desc
  53      *         A description of the error
  54      *
  55      * @param  regex
  56      *         The erroneous pattern
  57      *
  58      * @param  index
  59      *         The approximate index in the pattern of the error,
  60      *         or {@code -1} if the index is not known
  61      */
  62     public PatternSyntaxException(String desc, String regex, int index) {
  63         this.desc = desc;
  64         this.pattern = regex;
  65         this.index = index;
  66     }
  67 
  68     /**
  69      * Retrieves the error index.
  70      *
  71      * @return  The approximate index in the pattern of the error,
  72      *         or {@code -1} if the index is not known
  73      */
  74     public int getIndex() {
  75         return index;
  76     }
  77 
  78     /**
  79      * Retrieves the description of the error.
  80      *
  81      * @return  The description of the error
  82      */
  83     public String getDescription() {
  84         return desc;
  85     }
  86 
  87     /**
  88      * Retrieves the erroneous regular-expression pattern.
  89      *
  90      * @return  The erroneous pattern
  91      */
  92     public String getPattern() {


< prev index next >