Source Code Cross Referenced for DriverIOException.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » common » exceptions » driver » 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 JDBC Connection Pool » sequoia 2.10.9 » org.continuent.sequoia.common.exceptions.driver 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Sequoia: Database clustering technology.
003:         * Copyright (C) 2006 Continuent, Inc.
004:         * Contact: sequoia@continuent.org
005:         * 
006:         * Licensed under the Apache License, Version 2.0 (the "License");
007:         * you may not use this file except in compliance with the License.
008:         * You may obtain a copy of the License at
009:         * 
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS,
014:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License. 
017:         *
018:         * Initial developer(s): Emmanuel Cecchet
019:         * Contributor(s): ______________________.
020:         */package org.continuent.sequoia.common.exceptions.driver;
021:
022:        import java.io.PrintStream;
023:        import java.io.PrintWriter;
024:        import java.sql.SQLException;
025:
026:        import org.continuent.sequoia.common.exceptions.driver.protocol.SerializableException;
027:
028:        /**
029:         * This class customizes SQLException and is used for reporting internal IO
030:         * exception catched by the driver.
031:         */
032:        public class DriverIOException extends SQLException {
033:            private static final long serialVersionUID = 5066115114622251828L;
034:
035:            /**
036:             * @see SQLException#SQLException()
037:             */
038:            public DriverIOException() {
039:                super ();
040:            }
041:
042:            /**
043:             * @see SQLException#SQLException(java.lang.String)
044:             */
045:            public DriverIOException(String reason) {
046:                super (reason);
047:            }
048:
049:            /**
050:             * @see SQLException#SQLException(java.lang.String, java.lang.String)
051:             */
052:            public DriverIOException(String reason, String sQLState) {
053:                super (reason, sQLState);
054:            }
055:
056:            /**
057:             * @see SQLException#SQLException(java.lang.String, java.lang.String, int)
058:             */
059:            public DriverIOException(String reason, String sQLState,
060:                    int vendorCode) {
061:                super (reason, sQLState, vendorCode);
062:            }
063:
064:            /**
065:             * Creates a new <code>DriverIOException</code> around a
066:             * SerializableException received from controller, itself converted from an
067:             * SQLException in most cases. So we set SQLState and vendorCode.
068:             * 
069:             * @param message message
070:             * @param cause exception from controller to wrap
071:             */
072:            public DriverIOException(String message, SerializableException cause) {
073:                super (message, cause.getSQLState(), cause.getErrorCode());
074:                initCause(cause);
075:            }
076:
077:            /**
078:             * Missing message constructor: let's borrow message from cause.
079:             * 
080:             * @param cause exception to wrap
081:             */
082:            public DriverIOException(SerializableException cause) {
083:                this ("Message of cause: " + cause.getLocalizedMessage(), cause);
084:            }
085:
086:            /**
087:             * Missing message constructor: let's borrow message from cause.
088:             * 
089:             * @param cause exception to wrap
090:             */
091:            public DriverIOException(Exception cause) {
092:                /**
093:                 * @see #DriverIOException(String, SerializableException)
094:                 * @see #DriverIOException(String, Exception)
095:                 */
096:                this ("Message of cause: " + cause.getLocalizedMessage(), cause);
097:            }
098:
099:            /**
100:             * Creates a new <code>DriverIOException</code> around an exception of a
101:             * type not specifically handled elsewhere. Typically used for exceptions
102:             * internal to the driver.
103:             * 
104:             * @param message message
105:             * @param cause generic exception to wrap
106:             */
107:            public DriverIOException(String message, Exception cause) {
108:                super (message);
109:                initCause(cause);
110:            }
111:
112:            /**
113:             * @see #DriverIOException(String, SQLException)
114:             * @deprecated
115:             */
116:            public DriverIOException(SQLException cause) {
117:                this ("", cause);
118:            }
119:
120:            /**
121:             * An SQLException should not be wrapped inside a DriverSQLException: this is
122:             * a symptom of mixing different layers.
123:             * 
124:             * @param message message
125:             * @param cause cause
126:             * @deprecated
127:             * @throws IllegalArgumentException always
128:             */
129:            public DriverIOException(String message, SQLException cause)
130:                    throws IllegalArgumentException {
131:                // ok let's be tolerant for the moment
132:                super (message);
133:                initCause(cause);
134:
135:                // TODO: ... but this is the future:
136:                // A (Driver-)SQLException should be created here and nowhere below
137:
138:                // IllegalArgumentException iae = new IllegalArgumentException(
139:                // "Bug: cause of a DriverSQLException should not itself be an SQLException
140:                // "
141:                // + message);
142:                // iae.initCause(cause);
143:                // throw iae;
144:            }
145:
146:            /**
147:             * Overrides super method so we print the serializable stack trace of next
148:             * exceptions in the chain (if they use our serializable stack trace)
149:             * 
150:             * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
151:             */
152:            public void printStackTrace(PrintStream s) {
153:                /*
154:                 * super does unfortunately not call printStackTrace() recursively on the
155:                 * chain: instead it breaks object encapsulation by calling instead printing
156:                 * methods and private fields on nexts. And since our chain uses its own
157:                 * private stack trace implementation (because of JDK 1.4 woes) this does
158:                 * print nothing in the end.
159:                 */
160:                super .printStackTrace(s);
161:
162:                // So we have to call printStackStrace() ourselves.
163:                Throwable cause = getCause();
164:                if (null != cause && cause instanceof  SerializableException) {
165:                    s.println("SerializableStackTrace of each cause:");
166:                    ((SerializableException) cause).printStackTrace(s);
167:                }
168:            }
169:
170:            /**
171:             * Overrides super method so we print the serializable stack trace of next
172:             * exceptions in the chain (if they use our serializable stack trace)
173:             * 
174:             * @see java.lang.Throwable#printStackTrace()
175:             */
176:            public void printStackTrace() {
177:                /**
178:                 * This comes back to
179:                 * 
180:                 * @see DriverSQLException#printStackTrace(PrintStream)
181:                 */
182:                super .printStackTrace();
183:
184:            }
185:
186:            /**
187:             * Overrides super method so we print the serializable stack trace of next
188:             * exceptions in the chain (if they use our serializable stack trace)
189:             * 
190:             * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
191:             */
192:            public void printStackTrace(PrintWriter s) {
193:                /** @see #printStackTrace(PrintStream) */
194:                super .printStackTrace(s);
195:
196:                Throwable cause = getCause();
197:                if (null != cause && cause instanceof  SerializableException) {
198:                    s.println("SerializableStackTrace of each cause:");
199:                    ((SerializableException) cause).printStackTrace(s);
200:                }
201:            }
202:
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.