Source Code Cross Referenced for MessagingException.java in  » 6.0-JDK-Modules-com.sun » xml » com » sun » xml » internal » messaging » saaj » packaging » mime » 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 » 6.0 JDK Modules com.sun » xml » com.sun.xml.internal.messaging.saaj.packaging.mime 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)MessagingException.java        1.10 02/06/13
003:         */
004:
005:        /*
006:         * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
007:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
008:         *
009:         * This code is free software; you can redistribute it and/or modify it
010:         * under the terms of the GNU General Public License version 2 only, as
011:         * published by the Free Software Foundation.  Sun designates this
012:         * particular file as subject to the "Classpath" exception as provided
013:         * by Sun in the LICENSE file that accompanied this code.
014:         *
015:         * This code is distributed in the hope that it will be useful, but WITHOUT
016:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
017:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
018:         * version 2 for more details (a copy is included in the LICENSE file that
019:         * accompanied this code).
020:         *
021:         * You should have received a copy of the GNU General Public License version
022:         * 2 along with this work; if not, write to the Free Software Foundation,
023:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
024:         *
025:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
026:         * CA 95054 USA or visit www.sun.com if you need additional information or
027:         * have any questions.
028:         */
029:
030:        package com.sun.xml.internal.messaging.saaj.packaging.mime;
031:
032:        /**
033:         * The base class for all exceptions thrown by the Messaging classes
034:         *
035:         * @author John Mani
036:         * @author Bill Shannon
037:         */
038:
039:        public class MessagingException extends Exception {
040:
041:            /**
042:             * The next exception in the chain.
043:             *
044:             * @serial
045:             */
046:            private Exception next;
047:
048:            /**
049:             * Constructs a MessagingException with no detail message.
050:             */
051:            public MessagingException() {
052:                super ();
053:            }
054:
055:            /**
056:             * Constructs a MessagingException with the specified detail message.
057:             * @param s		the detail message
058:             */
059:            public MessagingException(String s) {
060:                super (s);
061:            }
062:
063:            /**
064:             * Constructs a MessagingException with the specified 
065:             * Exception and detail message. The specified exception is chained
066:             * to this exception.
067:             * @param s		the detail message
068:             * @param e		the embedded exception
069:             * @see	#getNextException
070:             * @see	#setNextException
071:             */
072:            public MessagingException(String s, Exception e) {
073:                super (s);
074:                next = e;
075:            }
076:
077:            /**
078:             * Get the next exception chained to this one. If the
079:             * next exception is a MessagingException, the chain
080:             * may extend further.
081:             *
082:             * @return	next Exception, null if none.
083:             */
084:            public Exception getNextException() {
085:                return next;
086:            }
087:
088:            /**
089:             * Add an exception to the end of the chain. If the end
090:             * is <strong>not</strong> a MessagingException, this 
091:             * exception cannot be added to the end.
092:             *
093:             * @param	ex	the new end of the Exception chain
094:             * @return		<code>true</code> if the this Exception
095:             *			was added, <code>false</code> otherwise.
096:             */
097:            public synchronized boolean setNextException(Exception ex) {
098:                Exception theEnd = this ;
099:                while (theEnd instanceof  MessagingException
100:                        && ((MessagingException) theEnd).next != null) {
101:                    theEnd = ((MessagingException) theEnd).next;
102:                }
103:                // If the end is a MessagingException, we can add this 
104:                // exception to the chain.
105:                if (theEnd instanceof  MessagingException) {
106:                    ((MessagingException) theEnd).next = ex;
107:                    return true;
108:                } else
109:                    return false;
110:            }
111:
112:            /**
113:             * Produce the message, include the message from the nested
114:             * exception if there is one.
115:             */
116:            public String getMessage() {
117:                if (next == null)
118:                    return super .getMessage();
119:                Exception n = next;
120:                String s = super .getMessage();
121:                StringBuffer sb = new StringBuffer(s == null ? "" : s);
122:                while (n != null) {
123:                    sb.append(";\n  nested exception is:\n\t");
124:                    if (n instanceof  MessagingException) {
125:                        MessagingException mex = (MessagingException) n;
126:                        sb.append(n.getClass().toString());
127:                        String msg = mex.getSuperMessage();
128:                        if (msg != null) {
129:                            sb.append(": ");
130:                            sb.append(msg);
131:                        }
132:                        n = mex.next;
133:                    } else {
134:                        sb.append(n.toString());
135:                        n = null;
136:                    }
137:                }
138:                return sb.toString();
139:            }
140:
141:            private String getSuperMessage() {
142:                return super.getMessage();
143:            }
144:        }
w_ww___.___j__a_v__a2___s__.___c__om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.