Source Code Cross Referenced for ProgrammingException.java in  » Web-Services » xins » org » xins » common » 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 » Web Services » xins » org.xins.common 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ProgrammingException.java,v 1.18 2007/03/16 09:54:58 agoubard Exp $
003:         *
004:         * Copyright 2003-2007 Orange Nederland Breedband B.V.
005:         * See the COPYRIGHT file for redistribution and use restrictions.
006:         */
007:        package org.xins.common;
008:
009:        import org.xins.logdoc.ExceptionUtils;
010:
011:        /**
012:         * Exception thrown when a programming error is detected.
013:         *
014:         * @version $Revision: 1.18 $ $Date: 2007/03/16 09:54:58 $
015:         * @author <a href="mailto:ernst@ernstdehaan.com">Ernst de Haan</a>
016:         *
017:         * @since XINS 1.1.0
018:         */
019:        public final class ProgrammingException extends RuntimeException {
020:
021:            /**
022:             * The name of the class that detected the problem. Is <code>null</code> if
023:             * unknown.
024:             */
025:            private final String _detectingClass;
026:
027:            /**
028:             * The name of the method where the problem was detected. Is
029:             * <code>null</code> if unknown.
030:             */
031:            private final String _detectingMethod;
032:
033:            /**
034:             * The name of the class which exposes the programming error. Is
035:             * <code>null</code> if unknown.
036:             */
037:            private final String _subjectClass;
038:
039:            /**
040:             * The name of the method which exposes the programming error, or
041:             * <code>null</code> if unknown.
042:             */
043:            private final String _subjectMethod;
044:
045:            /**
046:             * The detail message. Can be <code>null</code>.
047:             */
048:            private final String _detail;
049:
050:            /**
051:             * Constructs a new <code>ProgrammingException</code> for the specified
052:             * class and method, indicating which class and method detected the
053:             * problem.
054:             *
055:             * @param detectingClass
056:             *    the name of the class that detected the problem, or
057:             *    <code>null</code> if unknown.
058:             *
059:             * @param detectingMethod
060:             *    the name of the method within the <code>detectingClass</code> that
061:             *    detected the problem, or <code>null</code> if unknown.
062:             *
063:             * @param subjectClass
064:             *    the name of the class which exposes the programming error, or
065:             *    <code>null</code> if unknown.
066:             *
067:             * @param subjectMethod
068:             *    the name of the method (within the <code>subjectClass</code>) which
069:             *    exposes the programming error, or <code>null</code> if unknown.
070:             *
071:             * @param detail
072:             *    the detail message, can be <code>null</code>.
073:             *
074:             * @param cause
075:             *    the cause exception, can be <code>null</code>.
076:             */
077:            public ProgrammingException(String detectingClass,
078:                    String detectingMethod, String subjectClass,
079:                    String subjectMethod, String detail, Throwable cause) {
080:
081:                // Call superconstructor with a constructed message
082:                super (createMessage(detectingClass, detectingMethod,
083:                        subjectClass, subjectMethod, detail, cause));
084:
085:                // Register the cause for this exception
086:                ExceptionUtils.setCause(this , cause);
087:
088:                // Store all the information in fields
089:                _detectingClass = detectingClass;
090:                _detectingMethod = detectingMethod;
091:                _subjectClass = subjectClass;
092:                _subjectMethod = subjectMethod;
093:                _detail = detail;
094:            }
095:
096:            /**
097:             * Creates the exception message for the specified details.
098:             *
099:             * @param detectingClass
100:             *    the name of the class that detected the problem, or
101:             *    <code>null</code> if unknown.
102:             *
103:             * @param detectingMethod
104:             *    the name of the method within the <code>detectingClass</code> that
105:             *    detected the problem, or <code>null</code> if unknown.
106:             *
107:             * @param subjectClass
108:             *    the name of the class which exposes the programming error, or
109:             *    <code>null</code> if unknown.
110:             *
111:             * @param subjectMethod
112:             *    the name of the method (within the <code>subjectClass</code>) which
113:             *    exposes the programming error, or <code>null</code> if unknown.
114:             *
115:             * @param detail
116:             *    the detail message, can be <code>null</code>.
117:             *
118:             * @param cause
119:             *    the cause exception, can be <code>null</code>.
120:             *
121:             * @return
122:             *    the exception message, can be <code>null</code>.
123:             */
124:            private static String createMessage(String detectingClass,
125:                    String detectingMethod, String subjectClass,
126:                    String subjectMethod, String detail, Throwable cause) {
127:
128:                String message = "Programming error suspected";
129:
130:                if (subjectClass != null) {
131:                    message += " in class " + subjectClass;
132:                    if (subjectMethod != null) {
133:                        message += ", method " + subjectMethod;
134:                    }
135:                }
136:
137:                if (detectingClass != null) {
138:                    message += ". Detected by class " + detectingClass;
139:                    if (detectingMethod != null) {
140:                        message += ", method " + detectingMethod;
141:                    }
142:                }
143:
144:                if (detail != null) {
145:                    message += ". Detail: \"" + detail + "\"";
146:                }
147:
148:                message += ".";
149:
150:                return message;
151:            }
152:
153:            /**
154:             * Returns the name of the class that detected the problem.
155:             *
156:             * @return
157:             *    the name of the class that detected the problem, or <code>null</code>
158:             *    if unknown.
159:             *
160:             * @since XINS 1.3.0
161:             */
162:            public String getDetectingClass() {
163:                return _detectingClass;
164:            }
165:
166:            /**
167:             * Returns the name of the method where the problem was detected.
168:             *
169:             * @return
170:             *    the name of the method that detected the problem, or
171:             *    <code>null</code> if unknown.
172:             *
173:             * @since XINS 1.3.0
174:             */
175:            public String getDetectingMethod() {
176:                return _detectingMethod;
177:            }
178:
179:            /**
180:             * Returns the name of the class which exposes the programming error.
181:             *
182:             * @return
183:             *    the name of the class that exposed the problem, or
184:             *    <code>null</code> if unknown.
185:             *
186:             * @since XINS 1.3.0
187:             */
188:            public String getSubjectClass() {
189:                return _subjectClass;
190:            }
191:
192:            /**
193:             * Returns the name of the method which exposes the programming error.
194:             *
195:             * @return
196:             *    the name of the method that exposed the problem, or
197:             *    <code>null</code> if unknown.
198:             *
199:             * @since XINS 1.3.0
200:             */
201:            public String getSubjectMethod() {
202:                return _subjectMethod;
203:            }
204:
205:            /**
206:             * Returns the detail message.
207:             *
208:             * @return
209:             *    the detail message, can be <code>null</code>.
210:             *
211:             * @since XINS 1.3.0
212:             */
213:            public String getDetail() {
214:                return _detail;
215:            }
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.