Source Code Cross Referenced for CQLException.java in  » GIS » GeoTools-2.4.1 » org » geotools » filter » text » cql2 » 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 » GIS » GeoTools 2.4.1 » org.geotools.filter.text.cql2 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    Geotools2 - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2002, Geotools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *
016:         */
017:        package org.geotools.filter.text.cql2;
018:
019:        import org.geotools.filter.text.cql2.ParseException;
020:        import org.geotools.filter.text.cql2.Token;
021:
022:        /**
023:         * This exception is produced when the cql input string has sintax errors.
024:         *
025:         * @author Mauricio Pazos (Axios Engineering)
026:         * 
027:         * @version $Id: CQLException.java 28415 2007-12-18 09:54:31Z vmpazos $
028:         * @since 2.4
029:         */
030:        public class CQLException extends ParseException {
031:            /** for interoperability */
032:            private static final long serialVersionUID = 8873756073711225699L;
033:
034:            protected Throwable cause = null;
035:            private String cqlSource = null;
036:
037:            /**
038:             * New instance of CQLException
039:             *
040:             * @param message   exception description
041:             * @param token     current token
042:             * @param cause     the cause
043:             * @param cqlSource string analyzed
044:             */
045:            public CQLException(String message, Token token, Throwable cause,
046:                    String cqlSource) {
047:                super (message);
048:
049:                assert message != null;
050:
051:                super .currentToken = token;
052:
053:                this .cause = cause;
054:                this .cqlSource = cqlSource;
055:            }
056:
057:            /**
058:             * New instance of CQLException
059:             * 
060:             * @param message   exception description
061:             * @param token     current token
062:             * @param cqlSource analyzed string
063:             */
064:            public CQLException(final String message, final Token token,
065:                    final String cqlSource) {
066:                this (message, token, null, cqlSource);
067:            }
068:
069:            /**
070:             * New instance of CQLException
071:             *
072:             * @param message   exception description
073:             */
074:            public CQLException(String message) {
075:                this (message, null, null, null);
076:            }
077:
078:            /**
079:             * returns the cause
080:             *
081:             * @return the cause
082:             */
083:            public Throwable getCause() {
084:                return cause;
085:            }
086:
087:            /**
088:             * Returns the exception message
089:             *
090:             * @return a message
091:             */
092:            public String getMessage() {
093:                if (currentToken == null) {
094:                    return this .getMessage();
095:                }
096:
097:                return super .getMessage() + ", Current Token : "
098:                        + currentToken.image;
099:            }
100:
101:            /**
102:             * Returns the syntax error presents in the last sequence of characters analyzed.
103:             * 
104:             * @return the syntax error
105:             */
106:            public String getSyntaxError() {
107:
108:                // builds two lines the first has the source string, the second has
109:                // the pointer to syntax error.
110:
111:                // First Line
112:                StringBuffer msg = new StringBuffer(this .cqlSource);
113:                msg.append('\n');
114:
115:                // Second Line
116:                // searches the last token recognized 
117:                Token curToken = this .currentToken;
118:
119:                while (curToken.next != null)
120:                    curToken = curToken.next;
121:
122:                // add the pointer to error
123:                int column = curToken.beginColumn - 1;
124:
125:                for (int i = 0; i < column; i++) {
126:                    msg.append(' ');
127:                }
128:
129:                msg.append('^').append('\n');
130:                msg.append(this.getMessage());
131:
132:                return msg.toString();
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.