Source Code Cross Referenced for NestableError.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 errors which can contain other exceptions.
024:         *
025:         * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
026:         * @see org.apache.commons.lang.exception.NestableException
027:         * @since 1.0
028:         * @version $Id: NestableError.java 491650 2007-01-01 22:00:14Z ggregory $
029:         */
030:        public class NestableError extends Error implements  Nestable {
031:
032:            /**
033:             * Required for serialization support.
034:             * 
035:             * @see java.io.Serializable
036:             */
037:            private static final long serialVersionUID = 1L;
038:
039:            /**
040:             * The helper instance which contains much of the code which we
041:             * delegate to.
042:             */
043:            protected NestableDelegate delegate = new NestableDelegate(this );
044:
045:            /**
046:             * Holds the reference to the exception or error that caused
047:             * this exception to be thrown.
048:             */
049:            private Throwable cause = null;
050:
051:            /**
052:             * Constructs a new <code>NestableError</code> without specified
053:             * detail message.
054:             */
055:            public NestableError() {
056:                super ();
057:            }
058:
059:            /**
060:             * Constructs a new <code>NestableError</code> with specified
061:             * detail message.
062:             *
063:             * @param msg The error message.
064:             */
065:            public NestableError(String msg) {
066:                super (msg);
067:            }
068:
069:            /**
070:             * Constructs a new <code>NestableError</code> with specified
071:             * nested <code>Throwable</code>.
072:             *
073:             * @param cause the exception or error that caused this exception to be
074:             * thrown
075:             */
076:            public NestableError(Throwable cause) {
077:                super ();
078:                this .cause = cause;
079:            }
080:
081:            /**
082:             * Constructs a new <code>NestableError</code> with specified
083:             * detail message and nested <code>Throwable</code>.
084:             *
085:             * @param msg    the error message
086:             * @param cause  the exception or error that caused this exception to be
087:             * thrown
088:             */
089:            public NestableError(String msg, Throwable cause) {
090:                super (msg);
091:                this .cause = cause;
092:            }
093:
094:            /**
095:             * {@inheritDoc}
096:             */
097:            public Throwable getCause() {
098:                return cause;
099:            }
100:
101:            /**
102:             * Returns the detail message string of this throwable. If it was
103:             * created with a null message, returns the following:
104:             * (cause==null ? null : cause.toString()).
105:             *
106:             * @return String message string of the throwable
107:             */
108:            public String getMessage() {
109:                if (super .getMessage() != null) {
110:                    return super .getMessage();
111:                } else if (cause != null) {
112:                    return cause.toString();
113:                } else {
114:                    return null;
115:                }
116:            }
117:
118:            /**
119:             * {@inheritDoc}
120:             */
121:            public String getMessage(int index) {
122:                if (index == 0) {
123:                    return super .getMessage();
124:                }
125:                return delegate.getMessage(index);
126:            }
127:
128:            /**
129:             * {@inheritDoc}
130:             */
131:            public String[] getMessages() {
132:                return delegate.getMessages();
133:            }
134:
135:            /**
136:             * {@inheritDoc}
137:             */
138:            public Throwable getThrowable(int index) {
139:                return delegate.getThrowable(index);
140:            }
141:
142:            /**
143:             * {@inheritDoc}
144:             */
145:            public int getThrowableCount() {
146:                return delegate.getThrowableCount();
147:            }
148:
149:            /**
150:             * {@inheritDoc}
151:             */
152:            public Throwable[] getThrowables() {
153:                return delegate.getThrowables();
154:            }
155:
156:            /**
157:             * {@inheritDoc}
158:             */
159:            public int indexOfThrowable(Class type) {
160:                return delegate.indexOfThrowable(type, 0);
161:            }
162:
163:            /**
164:             * {@inheritDoc}
165:             */
166:            public int indexOfThrowable(Class type, int fromIndex) {
167:                return delegate.indexOfThrowable(type, fromIndex);
168:            }
169:
170:            /**
171:             * {@inheritDoc}
172:             */
173:            public void printStackTrace() {
174:                delegate.printStackTrace();
175:            }
176:
177:            /**
178:             * {@inheritDoc}
179:             */
180:            public void printStackTrace(PrintStream out) {
181:                delegate.printStackTrace(out);
182:            }
183:
184:            /**
185:             * {@inheritDoc}
186:             */
187:            public void printStackTrace(PrintWriter out) {
188:                delegate.printStackTrace(out);
189:            }
190:
191:            /**
192:             * {@inheritDoc}
193:             */
194:            public final void printPartialStackTrace(PrintWriter out) {
195:                super.printStackTrace(out);
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.