Source Code Cross Referenced for REException.java in  » Database-DBMS » mckoi » gnu » regexp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » mckoi » gnu.regexp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  gnu/regexp/REException.java
003:         *  Copyright (C) 1998-2001 Wes Biggs
004:         *
005:         *  This library is free software; you can redistribute it and/or modify
006:         *  it under the terms of the GNU Lesser General Public License as published
007:         *  by the Free Software Foundation; either version 2.1 of the License, or
008:         *  (at your option) any later version.
009:         *
010:         *  This library is distributed in the hope that it will be useful,
011:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013:         *  GNU Lesser General Public License for more details.
014:         *
015:         *  You should have received a copy of the GNU Lesser General Public License
016:         *  along with this program; if not, write to the Free Software
017:         *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
018:         */
019:
020:        package gnu.regexp;
021:
022:        import java.text.MessageFormat;
023:
024:        /**
025:         * This is the regular expression exception class.  An exception of this type
026:         * defines the three attributes:
027:         * <OL>
028:         * <LI> A descriptive message of the error.
029:         * <LI> An integral type code equivalent to one of the statically
030:         *      defined symbols listed below.
031:         * <LI> The approximate position in the input string where the error
032:         *      occurred.
033:         * </OL>
034:         *
035:         * @author <A HREF="mailto:wes@cacas.org">Wes Biggs</A>
036:         */
037:
038:        public class REException extends Exception {
039:            private int type;
040:            private int pos;
041:
042:            // Error conditions from GNU regcomp(3) manual
043:
044:            /**
045:             * Error flag.
046:             * Invalid use of repetition operators such  as  using
047:             * `*' as the first character.
048:             */
049:            public static final int REG_BADRPT = 1;
050:
051:            /**
052:             * Error flag.
053:             * Invalid use of back reference operator.
054:             */
055:            public static final int REG_BADBR = 2;
056:
057:            /**
058:             * Error flag.
059:             * Un-matched brace interval operators.
060:             */
061:            public static final int REG_EBRACE = 3;
062:
063:            /**
064:             * Error flag.
065:             * Un-matched bracket list operators.
066:             */
067:            public static final int REG_EBRACK = 4;
068:
069:            /**
070:             * Error flag.
071:             * Invalid  use  of the range operator, eg. the ending
072:             * point of the range occurs  prior  to  the  starting
073:             * point.
074:             */
075:            public static final int REG_ERANGE = 5;
076:
077:            /**
078:             * Error flag.
079:             * Unknown character class name. <B>Not implemented</B>.
080:             */
081:            public static final int REG_ECTYPE = 6;
082:
083:            /**
084:             * Error flag.
085:             * Un-matched parenthesis group operators.
086:             */
087:            public static final int REG_EPAREN = 7;
088:
089:            /**
090:             * Error flag.
091:             * Invalid back reference to a subexpression.
092:             */
093:            public static final int REG_ESUBREG = 8;
094:
095:            /**
096:             * Error flag.
097:             * Non specific error. <B>Not implemented</B>.
098:             */
099:            public static final int REG_EEND = 9;
100:
101:            /**
102:             * Error flag.
103:             * Invalid escape sequence. <B>Not implemented</B>.
104:             */
105:            public static final int REG_ESCAPE = 10;
106:
107:            /**
108:             * Error flag.
109:             * Invalid  use  of pattern operators such as group or list.
110:             */
111:            public static final int REG_BADPAT = 11;
112:
113:            /**
114:             * Error flag.
115:             * Compiled  regular  expression  requires  a  pattern
116:             * buffer larger than 64Kb. <B>Not implemented</B>.
117:             */
118:            public static final int REG_ESIZE = 12;
119:
120:            /**
121:             * Error flag.
122:             * The regex routines ran out of memory. <B>Not implemented</B>.
123:             */
124:            public static final int REG_ESPACE = 13;
125:
126:            REException(String msg, int type, int position) {
127:                super (msg);
128:                this .type = type;
129:                this .pos = position;
130:            }
131:
132:            /**
133:             * Returns the type of the exception, one of the constants listed above.
134:             */
135:
136:            public int getType() {
137:                return type;
138:            }
139:
140:            /**
141:             * Returns the position, relative to the string or character array being
142:             * compiled, where the error occurred.  This position is generally the point
143:             * where the error was detected, not necessarily the starting index of
144:             * a bad subexpression.
145:             */
146:            public int getPosition() {
147:                return pos;
148:            }
149:
150:            /**
151:             * Reports the descriptive message associated with this exception
152:             * as well as its index position in the string or character array
153:             * being compiled.
154:             */
155:            public String getMessage() {
156:                Object[] args = { new Integer(pos) };
157:                StringBuffer sb = new StringBuffer();
158:                String prefix = RE.getLocalizedMessage("error.prefix");
159:                sb.append(MessageFormat.format(prefix, args));
160:                sb.append('\n');
161:                sb.append(super.getMessage());
162:                return sb.toString();
163:            }
164:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.