Source Code Cross Referenced for JPOXException.java in  » Database-ORM » JPOX » org » jpox » exceptions » 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 ORM » JPOX » org.jpox.exceptions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************
002:        Copyright (c) 2006 Andy Jefferson and others. All rights reserved.
003:        Licensed under the Apache License, Version 2.0 (the "License");
004:        you may not use this file except in compliance with the License.
005:        You may obtain a copy of the License at
006:
007:            http://www.apache.org/licenses/LICENSE-2.0
008:
009:        Unless required by applicable law or agreed to in writing, software
010:        distributed under the License is distributed on an "AS IS" BASIS,
011:        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        See the License for the specific language governing permissions and
013:        limitations under the License.
014:
015:        Contributors:
016:            ...
017:         **********************************************************************/package org.jpox.exceptions;
018:
019:        /**
020:         * Base exception thrown by JPOX.
021:         *
022:         * @version $Revision: 1.2 $
023:         */
024:        public class JPOXException extends RuntimeException {
025:            /** Array of nested Throwables (optional) */
026:            Throwable[] nested;
027:
028:            /** The object being processed when the error was encountered (optional). */
029:            Object failed;
030:
031:            /** Flag defining if this exception is fatal, or could be retried with the possibility of success. */
032:            boolean fatal;
033:
034:            /**
035:             * Constructs a new exception without a detail message.
036:             */
037:            public JPOXException() {
038:            }
039:
040:            /**
041:             * Constructs a new exception with the specified detail message.
042:             * @param msg the detail message.
043:             */
044:            public JPOXException(String msg) {
045:                super (msg);
046:            }
047:
048:            /**
049:             * Constructs a new exception with the specified detail message and nested <code>Throwable</code>s.
050:             * @param msg the detail message.
051:             * @param nested the nested <code>Throwable[]</code>.
052:             */
053:            public JPOXException(String msg, Throwable[] nested) {
054:                super (msg);
055:                this .nested = nested;
056:            }
057:
058:            /**
059:             * Constructs a new exception with the specified detail message and nested <code>Throwable</code>.
060:             * @param msg the detail message.
061:             * @param nested the nested <code>Throwable</code>.
062:             */
063:            public JPOXException(String msg, Throwable nested) {
064:                super (msg);
065:                this .nested = new Throwable[] { nested };
066:            }
067:
068:            /**
069:             * Constructs a new exception with the specified detail message and failed object.
070:             * @param msg the detail message.
071:             * @param failed the failed object.
072:             */
073:            public JPOXException(String msg, Object failed) {
074:                super (msg);
075:                this .failed = failed;
076:            }
077:
078:            /**
079:             * Constructs a new exception with the specified detail
080:             * message, nested <code>Throwable</code>s, and failed object.
081:             * @param msg the detail message.
082:             * @param nested the nested <code>Throwable[]</code>.
083:             * @param failed the failed object.
084:             */
085:            public JPOXException(String msg, Throwable[] nested, Object failed) {
086:                super (msg);
087:                this .nested = nested;
088:                this .failed = failed;
089:            }
090:
091:            /**
092:             * Constructs a new exception with the specified detail message, nested <code>Throwable</code>,
093:             * and failed object.
094:             * @param msg the detail message.
095:             * @param nested the nested <code>Throwable</code>.
096:             * @param failed the failed object.
097:             */
098:            public JPOXException(String msg, Throwable nested, Object failed) {
099:                super (msg);
100:                this .nested = new Throwable[] { nested };
101:                this .failed = failed;
102:            }
103:
104:            /**
105:             * Method to set the exception as being fatal.
106:             * Returns the exception so that user code can call
107:             * "throw new JPOXException(...).setFatal();"
108:             * @return This exception (for convenience)
109:             */
110:            public JPOXException setFatal() {
111:                fatal = true;
112:                return this ;
113:            }
114:
115:            /**
116:             * Accessor for whether the exception is fatal, or retriable.
117:             * @return Whether it is fatal
118:             */
119:            public boolean isFatal() {
120:                return fatal;
121:            }
122:
123:            /**
124:             * The exception may include a failed object.
125:             * @return the failed object.
126:             */
127:            public Object getFailedObject() {
128:                return failed;
129:            }
130:
131:            /**
132:             * The exception may have been caused by multiple exceptions in the runtime.
133:             * If multiple objects caused the problem, each failed object will have its
134:             * own <code>Exception</code>.
135:             * @return the nested Throwable array.
136:             */
137:            public Throwable[] getNestedExceptions() {
138:                return nested;
139:            }
140:
141:            /**
142:             * Return the first nested exception (if any), otherwise null.
143:             * @return the first or only nested Throwable.
144:             */
145:            public synchronized Throwable getCause() {
146:                return ((nested == null || nested.length == 0) ? null
147:                        : nested[0]);
148:            }
149:
150:            /**
151:             * Prints this <code>Exception</code> and its backtrace to the standard
152:             * error output. Print nested Throwables' stack trace as well.
153:             */
154:            public void printStackTrace() {
155:                printStackTrace(System.err);
156:            }
157:
158:            /**
159:             * Prints this <code>Exception</code> and its backtrace to the
160:             * specified print stream. Print nested Throwables' stack trace as well.
161:             * @param s <code>PrintStream</code> to use for output
162:             */
163:            public synchronized void printStackTrace(java.io.PrintStream s) {
164:                int len = nested == null ? 0 : nested.length;
165:                synchronized (s) {
166:                    if (getMessage() != null) {
167:                        s.println(getMessage());
168:                    }
169:                    super .printStackTrace(s);
170:                    if (len > 0) {
171:                        s.println("Nested Throwables StackTrace:");
172:                        for (int i = 0; i < len; ++i) {
173:                            Throwable exception = nested[i];
174:                            if (exception != null) {
175:                                exception.printStackTrace(s);
176:                            }
177:                        }
178:                    }
179:                }
180:            }
181:
182:            /**
183:             * Prints this <code>Exception</code> and its backtrace to the
184:             * specified print writer. Print nested Throwables' stack trace as well.
185:             * @param s <code>PrintWriter</code> to use for output
186:             */
187:            public synchronized void printStackTrace(java.io.PrintWriter s) {
188:                int len = nested == null ? 0 : nested.length;
189:                synchronized (s) {
190:                    if (getMessage() != null) {
191:                        s.println(getMessage());
192:                    }
193:                    super .printStackTrace(s);
194:                    if (len > 0) {
195:                        s.println("Nested Throwables StackTrace:");
196:                        for (int i = 0; i < len; ++i) {
197:                            Throwable exception = nested[i];
198:                            if (exception != null) {
199:                                exception.printStackTrace(s);
200:                            }
201:                        }
202:                    }
203:                }
204:            }
205:
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.