Source Code Cross Referenced for ProcessingException.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon 
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.cocoon;
018:
019:        import java.util.List;
020:
021:        import org.apache.cocoon.util.location.LocatedException;
022:        import org.apache.cocoon.util.location.LocatedRuntimeException;
023:        import org.apache.cocoon.util.location.Location;
024:        import org.apache.cocoon.util.location.MultiLocatable;
025:
026:        /**
027:         * This Exception is thrown every time there is a problem in processing
028:         * a request.
029:         *
030:         * @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
031:         *         (Apache Software Foundation)
032:         * @version CVS $Id: ProcessingException.java 433543 2006-08-22 06:22:54Z crossley $
033:         */
034:        public class ProcessingException extends LocatedException {
035:
036:            /**
037:             * Construct a new <code>ProcessingException</code> instance.
038:             */
039:            public ProcessingException(String message) {
040:                super (message);
041:            }
042:
043:            /**
044:             * Creates a new <code>ProcessingException</code> instance.
045:             *
046:             * @param ex an <code>Exception</code> value
047:             */
048:            public ProcessingException(Exception ex) {
049:                super (ex.getMessage(), ex);
050:            }
051:
052:            /**
053:             * Construct a new <code>ProcessingException</code> that references
054:             * a parent Exception.
055:             */
056:            public ProcessingException(String message, Throwable t) {
057:                super (message, t);
058:            }
059:
060:            /**
061:             * Construct a new <code>ProcessingException</code> that has an associated location.
062:             */
063:            public ProcessingException(String message, Location location) {
064:                super (message, location);
065:            }
066:
067:            /**
068:             * Construct a new <code>ProcessingException</code> that has a parent exception
069:             * and an associated location.
070:             * <p>
071:             * This constructor is protected to enforce the use of {@link #throwLocated(String, Throwable, Location)}
072:             * which limits exception nesting as far as possible.
073:             */
074:            protected ProcessingException(String message, Throwable t,
075:                    Location location) {
076:                super (message, t, location);
077:            }
078:
079:            /**
080:             * Throw a located exception given an existing exception and the location where
081:             * this exception was catched.
082:             * <p>
083:             * If the exception is already a <code>ProcessingException</code> or a {@link LocatedRuntimeException},
084:             * the location is added to the original exception's location chain and the original exception
085:             * is rethrown (<code>description</code> is ignored) to limit exception nesting. Otherwise, a new
086:             * <code>ProcessingException</code> is thrown, wrapping the original exception.
087:             * <p>
088:             * Note: this method returns an exception as a convenience if you want to keep the <code>throw</code>
089:             * semantics in the caller code, i.e. write<br>
090:             * <code>&nbsp;&nbsp;throw ProcessingException.throwLocated(...);</code><br>
091:             * instead of<br>
092:             * <code>&nbsp;&nbsp;ProcessingException.throwLocated(...);</code><br>
093:             * <code>&nbsp;&nbsp;return;</code>
094:             * 
095:             * @param message a message (can be <code>null</code>)
096:             * @param thr the original exception (can be <code>null</code>)
097:             * @param location the location (can be <code>null</code>)
098:             * @return a (fake) located exception
099:             * @throws ProcessingException or <code>LocatedRuntimeException</code>
100:             */
101:            public static ProcessingException throwLocated(String message,
102:                    Throwable thr, Location location)
103:                    throws ProcessingException {
104:                if (thr instanceof  ProcessingException) {
105:                    ProcessingException pe = (ProcessingException) thr;
106:                    pe.addLocation(location);
107:                    throw pe;
108:
109:                } else if (thr instanceof  LocatedRuntimeException) {
110:                    LocatedRuntimeException re = (LocatedRuntimeException) thr;
111:                    re.addLocation(location);
112:                    // Rethrow
113:                    throw re;
114:                }
115:
116:                throw new ProcessingException(message, thr, location);
117:            }
118:
119:            /**
120:             * Throw a located exception given an existing exception and the locations where
121:             * this exception was catched.
122:             * <p>
123:             * If the exception is already a <code>ProcessingException</code> or a {@link LocatedRuntimeException},
124:             * the locations are added to the original exception's location chain and the original exception
125:             * is rethrown (<code>description</code> is ignored) to limit exception nesting. Otherwise, a new
126:             * <code>ProcessingException</code> is thrown, wrapping the original exception.
127:             * <p>
128:             * Note: this method returns an exception as a convenience if you want to keep the <code>throw</code>
129:             * semantics in the caller code, i.e. write<br>
130:             * <code>&nbsp;&nbsp;throw ProcessingException.throwLocated(...);</code><br>
131:             * instead of<br>
132:             * <code>&nbsp;&nbsp;ProcessingException.throwLocated(...);</code><br>
133:             * <code>&nbsp;&nbsp;return;</code>
134:             * 
135:             * @param message a message (can be <code>null</code>)
136:             * @param thr the original exception (can be <code>null</code>)
137:             * @param locations the locations (can be <code>null</code>)
138:             * @return a (fake) located exception
139:             * @throws ProcessingException or <code>LocatedRuntimeException</code>
140:             */
141:            public static ProcessingException throwLocated(String message,
142:                    Throwable thr, List locations) throws ProcessingException {
143:                MultiLocatable multiloc;
144:                if (thr instanceof  ProcessingException) {
145:                    multiloc = (ProcessingException) thr;
146:                } else if (thr instanceof  LocatedRuntimeException) {
147:                    multiloc = (LocatedRuntimeException) thr;
148:                } else {
149:                    multiloc = new ProcessingException(message, thr);
150:                }
151:
152:                if (locations != null) {
153:                    for (int i = 0; i < locations.size(); i++) {
154:                        multiloc.addLocation((Location) locations.get(i));
155:                    }
156:                }
157:
158:                if (multiloc instanceof  LocatedRuntimeException) {
159:                    throw (LocatedRuntimeException) multiloc;
160:                } else {
161:                    throw (ProcessingException) multiloc;
162:                }
163:            }
164:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.