KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > innig > macker > rule > MackerRegexSyntaxException


1 /*______________________________________________________________________________
2  *
3  * Macker http://innig.net/macker/
4  *
5  * Copyright 2002-2003 Paul Cantrell
6  *
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License version 2, as published by the
9  * Free Software Foundation. See the file LICENSE.html for more information.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the license for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
17  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
18  *______________________________________________________________________________
19  */

20  
21 package net.innig.macker.rule;
22
23 import org.jdom.Element;
24
25 import org.apache.regexp.RESyntaxException;
26
27 public class MackerRegexSyntaxException
28     extends RulesException
29     {
30     public MackerRegexSyntaxException(String JavaDoc regexp)
31         {
32         super(getMessage(regexp) + "");
33         this.regexp = regexp;
34         }
35     
36     public MackerRegexSyntaxException(String JavaDoc regexp, RESyntaxException cause)
37         {
38         super(getMessage(regexp) + ": ", cause);
39         this.regexp = regexp;
40         }
41     
42     public MackerRegexSyntaxException(String JavaDoc regexp, String JavaDoc message)
43         {
44         super(getMessage(regexp) + ": " + message);
45         this.regexp = regexp;
46         }
47     
48     public final String JavaDoc getRegexp()
49         { return regexp; }
50         
51     private static String JavaDoc getMessage(String JavaDoc regexp)
52         { return "\"" + regexp + "\" is not a valid Macker regexp pattern"; }
53     
54     private final String JavaDoc regexp;
55     }
56     
57     
58     
Popular Tags