Source Code Cross Referenced for NestableRuntimeException.java in  » Library » Apache-common-lang » org » apache » commons » lang » exception » 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 » Library » Apache common lang » org.apache.commons.lang.exception 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.commons.lang.exception;
018:
019:        import java.io.PrintStream;
020:        import java.io.PrintWriter;
021:
022:        /**
023:         * The base class of all runtime exceptions which can contain other
024:         * exceptions.
025:         *
026:         * @see org.apache.commons.lang.exception.NestableException
027:         * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
028:         * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
029:         * @author <a href="mailto:knielsen@apache.org">Kasper Nielsen</a>
030:         * @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
031:         * @since 1.0
032:         * @version $Id: NestableRuntimeException.java 491652 2007-01-01 22:01:57Z ggregory $
033:         */
034:        public class NestableRuntimeException extends RuntimeException
035:                implements  Nestable {
036:
037:            /**
038:             * Required for serialization support.
039:             * 
040:             * @see java.io.Serializable
041:             */
042:            private static final long serialVersionUID = 1L;
043:
044:            /**
045:             * The helper instance which contains much of the code which we
046:             * delegate to.
047:             */
048:            protected NestableDelegate delegate = new NestableDelegate(this );
049:
050:            /**
051:             * Holds the reference to the exception or error that caused
052:             * this exception to be thrown.
053:             */
054:            private Throwable cause = null;
055:
056:            /**
057:             * Constructs a new <code>NestableRuntimeException</code> without specified
058:             * detail message.
059:             */
060:            public NestableRuntimeException() {
061:                super ();
062:            }
063:
064:            /**
065:             * Constructs a new <code>NestableRuntimeException</code> with specified
066:             * detail message.
067:             *
068:             * @param msg the error message
069:             */
070:            public NestableRuntimeException(String msg) {
071:                super (msg);
072:            }
073:
074:            /**
075:             * Constructs a new <code>NestableRuntimeException</code> with specified
076:             * nested <code>Throwable</code>.
077:             *
078:             * @param cause the exception or error that caused this exception to be
079:             * thrown
080:             */
081:            public NestableRuntimeException(Throwable cause) {
082:                super ();
083:                this .cause = cause;
084:            }
085:
086:            /**
087:             * Constructs a new <code>NestableRuntimeException</code> with specified
088:             * detail message and nested <code>Throwable</code>.
089:             *
090:             * @param msg    the error message
091:             * @param cause  the exception or error that caused this exception to be
092:             * thrown
093:             */
094:            public NestableRuntimeException(String msg, Throwable cause) {
095:                super (msg);
096:                this .cause = cause;
097:            }
098:
099:            /**
100:             * {@inheritDoc}
101:             */
102:            public Throwable getCause() {
103:                return cause;
104:            }
105:
106:            /**
107:             * Returns the detail message string of this throwable. If it was
108:             * created with a null message, returns the following:
109:             * (cause==null ? null : cause.toString()).
110:             *
111:             * @return String message string of the throwable
112:             */
113:            public String getMessage() {
114:                if (super .getMessage() != null) {
115:                    return super .getMessage();
116:                } else if (cause != null) {
117:                    return cause.toString();
118:                } else {
119:                    return null;
120:                }
121:            }
122:
123:            /**
124:             * {@inheritDoc}
125:             */
126:            public String getMessage(int index) {
127:                if (index == 0) {
128:                    return super .getMessage();
129:                }
130:                return delegate.getMessage(index);
131:            }
132:
133:            /**
134:             * {@inheritDoc}
135:             */
136:            public String[] getMessages() {
137:                return delegate.getMessages();
138:            }
139:
140:            /**
141:             * {@inheritDoc}
142:             */
143:            public Throwable getThrowable(int index) {
144:                return delegate.getThrowable(index);
145:            }
146:
147:            /**
148:             * {@inheritDoc}
149:             */
150:            public int getThrowableCount() {
151:                return delegate.getThrowableCount();
152:            }
153:
154:            /**
155:             * {@inheritDoc}
156:             */
157:            public Throwable[] getThrowables() {
158:                return delegate.getThrowables();
159:            }
160:
161:            /**
162:             * {@inheritDoc}
163:             */
164:            public int indexOfThrowable(Class type) {
165:                return delegate.indexOfThrowable(type, 0);
166:            }
167:
168:            /**
169:             * {@inheritDoc}
170:             */
171:            public int indexOfThrowable(Class type, int fromIndex) {
172:                return delegate.indexOfThrowable(type, fromIndex);
173:            }
174:
175:            /**
176:             * {@inheritDoc}
177:             */
178:            public void printStackTrace() {
179:                delegate.printStackTrace();
180:            }
181:
182:            /**
183:             * {@inheritDoc}
184:             */
185:            public void printStackTrace(PrintStream out) {
186:                delegate.printStackTrace(out);
187:            }
188:
189:            /**
190:             * {@inheritDoc}
191:             */
192:            public void printStackTrace(PrintWriter out) {
193:                delegate.printStackTrace(out);
194:            }
195:
196:            /**
197:             * {@inheritDoc}
198:             */
199:            public final void printPartialStackTrace(PrintWriter out) {
200:                super.printStackTrace(out);
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.