Source Code Cross Referenced for SystemException.java in  » Ajax » zk » org » zkoss » lang » 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 » Ajax » zk » org.zkoss.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* SystemException.java
002:
003:        {{IS_NOTE
004:
005:        	Purpose: Thrown if a caught exception is not in the exception list.
006:        	Description: 
007:        	History:
008:        	 2001/5/15, Tom M. Yeh: Created.
009:
010:        }}IS_NOTE
011:
012:        Copyright (C) 2001 Potix Corporation. All Rights Reserved.
013:
014:        {{IS_RIGHT
015:        	This program is distributed under GPL Version 2.0 in the hope that
016:        	it will be useful, but WITHOUT ANY WARRANTY.
017:        }}IS_RIGHT
018:         */
019:        package org.zkoss.lang;
020:
021:        import org.zkoss.mesg.Messageable;
022:
023:        /**
024:         * Indicates a system exception.
025:         *
026:         * @author tomyeh
027:         */
028:        public class SystemException extends RuntimeException implements 
029:                Messageable {
030:            /** Utilities.
031:             *
032:             * <p>The reason to use a class to hold static utilities is we can
033:             * override the method's return type later.
034:             */
035:            public static class Aide {
036:                /** Converts an exception to SystemException or OperationException
037:                 * depending on whether t implements Expetable.
038:                 * @see Exceptions#wrap
039:                 */
040:                public static SystemException wrap(Throwable t) {
041:                    t = Exceptions.unwrap(t);
042:                    if (t instanceof  Warning)
043:                        return (WarningException) Exceptions.wrap(t,
044:                                WarningException.class);
045:                    if (t instanceof  Expectable)
046:                        return (OperationException) Exceptions.wrap(t,
047:                                OperationException.class);
048:                    return (SystemException) Exceptions.wrap(t,
049:                            SystemException.class);
050:                }
051:
052:                /** Converts an exception to SystemException or OperationException
053:                 * depending on whether t implements Expetable.
054:                 * @see Exceptions#wrap
055:                 */
056:                public static SystemException wrap(Throwable t, String msg) {
057:                    t = Exceptions.unwrap(t);
058:                    if (t instanceof  Warning)
059:                        return (WarningException) Exceptions.wrap(t,
060:                                WarningException.class, msg);
061:                    if (t instanceof  Expectable)
062:                        return (OperationException) Exceptions.wrap(t,
063:                                OperationException.class, msg);
064:                    return (SystemException) Exceptions.wrap(t,
065:                            SystemException.class, msg);
066:                }
067:
068:                /** Converts an exception to SystemException or OperationException
069:                 * depending on whether t implements Expetable.
070:                 * @see Exceptions#wrap
071:                 */
072:                public static SystemException wrap(Throwable t, int code,
073:                        Object[] fmtArgs) {
074:                    t = Exceptions.unwrap(t);
075:                    if (t instanceof  Warning)
076:                        return (WarningException) Exceptions.wrap(t,
077:                                WarningException.class, code, fmtArgs);
078:                    if (t instanceof  Expectable)
079:                        return (OperationException) Exceptions.wrap(t,
080:                                OperationException.class, code, fmtArgs);
081:                    return (SystemException) Exceptions.wrap(t,
082:                            SystemException.class, code, fmtArgs);
083:                }
084:
085:                /** Converts an exception to SystemException or OperationException
086:                 * depending on whether t implements Expetable.
087:                 * @see Exceptions#wrap
088:                 */
089:                public static SystemException wrap(Throwable t, int code,
090:                        Object fmtArg) {
091:                    t = Exceptions.unwrap(t);
092:                    if (t instanceof  Warning)
093:                        return (WarningException) Exceptions.wrap(t,
094:                                WarningException.class, code, fmtArg);
095:                    if (t instanceof  Expectable)
096:                        return (OperationException) Exceptions.wrap(t,
097:                                OperationException.class, code, fmtArg);
098:                    return (SystemException) Exceptions.wrap(t,
099:                            SystemException.class, code, fmtArg);
100:                }
101:
102:                /** Converts an exception to SystemException or OperationException
103:                 * depending on whether t implements Expetable.
104:                 * @see Exceptions#wrap
105:                 */
106:                public static SystemException wrap(Throwable t, int code) {
107:                    t = Exceptions.unwrap(t);
108:                    if (t instanceof  Warning)
109:                        return (WarningException) Exceptions.wrap(t,
110:                                WarningException.class, code);
111:                    if (t instanceof  Expectable)
112:                        return (OperationException) Exceptions.wrap(t,
113:                                OperationException.class, code);
114:                    return (SystemException) Exceptions.wrap(t,
115:                            SystemException.class, code);
116:                }
117:            }
118:
119:            protected int _code = NULL_CODE;
120:
121:            /**
122:             * Constructs a SystemException by specifying message directly.
123:             */
124:            public SystemException(String msg, Throwable cause) {
125:                super (msg, cause);
126:            }
127:
128:            public SystemException(String msg) {
129:                super (msg);
130:            }
131:
132:            public SystemException(Throwable cause) {
133:                super (cause);
134:            }
135:
136:            public SystemException() {
137:            }
138:
139:            /**
140:             * Constructs an SystemException by use of an error code.
141:             * The error code must be defined in
142:             * one of properties files, e.g., msgsys.properties.
143:             *
144:             * @param code the error code
145:             * @param fmtArgs the format arguments
146:             * @param cause the chained throwable object
147:             */
148:            public SystemException(int code, Object[] fmtArgs, Throwable cause) {
149:                super (Exceptions.getMessage(code, fmtArgs), cause);
150:                _code = code;
151:            }
152:
153:            public SystemException(int code, Object fmtArg, Throwable cause) {
154:                super (Exceptions.getMessage(code, fmtArg), cause);
155:                _code = code;
156:            }
157:
158:            public SystemException(int code, Object[] fmtArgs) {
159:                super (Exceptions.getMessage(code, fmtArgs));
160:                _code = code;
161:            }
162:
163:            public SystemException(int code, Object fmtArg) {
164:                super (Exceptions.getMessage(code, fmtArg));
165:                _code = code;
166:            }
167:
168:            public SystemException(int code, Throwable cause) {
169:                super (Exceptions.getMessage(code), cause);
170:                _code = code;
171:            }
172:
173:            public SystemException(int code) {
174:                super (Exceptions.getMessage(code));
175:                _code = code;
176:            }
177:
178:            //-- Messageable --//
179:            public final int getCode() {
180:                return _code;
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.