Source Code Cross Referenced for BuildException.java in  » Build » ANT » org » apache » tools » ant » 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 » Build » ANT » org.apache.tools.ant 
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:         */
018:        package org.apache.tools.ant;
019:
020:        import java.io.PrintStream;
021:        import java.io.PrintWriter;
022:
023:        /**
024:         * Signals an error condition during a build
025:         */
026:        public class BuildException extends RuntimeException {
027:
028:            /** Exception that might have caused this one. */
029:            private Throwable cause;
030:
031:            /** Location in the build file where the exception occurred */
032:            private Location location = Location.UNKNOWN_LOCATION;
033:
034:            /**
035:             * Constructs a build exception with no descriptive information.
036:             */
037:            public BuildException() {
038:                super ();
039:            }
040:
041:            /**
042:             * Constructs an exception with the given descriptive message.
043:             *
044:             * @param message A description of or information about the exception.
045:             *            Should not be <code>null</code>.
046:             */
047:            public BuildException(String message) {
048:                super (message);
049:            }
050:
051:            /**
052:             * Constructs an exception with the given message and exception as
053:             * a root cause.
054:             *
055:             * @param message A description of or information about the exception.
056:             *            Should not be <code>null</code> unless a cause is specified.
057:             * @param cause The exception that might have caused this one.
058:             *              May be <code>null</code>.
059:             */
060:            public BuildException(String message, Throwable cause) {
061:                super (message);
062:                this .cause = cause;
063:            }
064:
065:            /**
066:             * Constructs an exception with the given message and exception as
067:             * a root cause and a location in a file.
068:             *
069:             * @param msg A description of or information about the exception.
070:             *            Should not be <code>null</code> unless a cause is specified.
071:             * @param cause The exception that might have caused this one.
072:             *              May be <code>null</code>.
073:             * @param location The location in the project file where the error
074:             *                 occurred. Must not be <code>null</code>.
075:             */
076:            public BuildException(String msg, Throwable cause, Location location) {
077:                this (msg, cause);
078:                this .location = location;
079:            }
080:
081:            /**
082:             * Constructs an exception with the given exception as a root cause.
083:             *
084:             * @param cause The exception that might have caused this one.
085:             *              Should not be <code>null</code>.
086:             */
087:            public BuildException(Throwable cause) {
088:                super (cause.toString());
089:                this .cause = cause;
090:            }
091:
092:            /**
093:             * Constructs an exception with the given descriptive message and a
094:             * location in a file.
095:             *
096:             * @param message A description of or information about the exception.
097:             *            Should not be <code>null</code>.
098:             * @param location The location in the project file where the error
099:             *                 occurred. Must not be <code>null</code>.
100:             */
101:            public BuildException(String message, Location location) {
102:                super (message);
103:                this .location = location;
104:            }
105:
106:            /**
107:             * Constructs an exception with the given exception as
108:             * a root cause and a location in a file.
109:             *
110:             * @param cause The exception that might have caused this one.
111:             *              Should not be <code>null</code>.
112:             * @param location The location in the project file where the error
113:             *                 occurred. Must not be <code>null</code>.
114:             */
115:            public BuildException(Throwable cause, Location location) {
116:                this (cause);
117:                this .location = location;
118:            }
119:
120:            /**
121:             * Returns the nested exception, if any.
122:             *
123:             * @return the nested exception, or <code>null</code> if no
124:             *         exception is associated with this one
125:             */
126:            public Throwable getException() {
127:                return cause;
128:            }
129:
130:            /**
131:             * Returns the nested exception, if any.
132:             *
133:             * @return the nested exception, or <code>null</code> if no
134:             *         exception is associated with this one
135:             */
136:            public Throwable getCause() {
137:                return getException();
138:            }
139:
140:            /**
141:             * Returns the location of the error and the error message.
142:             *
143:             * @return the location of the error and the error message
144:             */
145:            public String toString() {
146:                return location.toString() + getMessage();
147:            }
148:
149:            /**
150:             * Sets the file location where the error occurred.
151:             *
152:             * @param location The file location where the error occurred.
153:             *                 Must not be <code>null</code>.
154:             */
155:            public void setLocation(Location location) {
156:                this .location = location;
157:            }
158:
159:            /**
160:             * Returns the file location where the error occurred.
161:             *
162:             * @return the file location where the error occurred.
163:             */
164:            public Location getLocation() {
165:                return location;
166:            }
167:
168:            /**
169:             * Prints the stack trace for this exception and any
170:             * nested exception to <code>System.err</code>.
171:             */
172:            public void printStackTrace() {
173:                printStackTrace(System.err);
174:            }
175:
176:            /**
177:             * Prints the stack trace of this exception and any nested
178:             * exception to the specified PrintStream.
179:             *
180:             * @param ps The PrintStream to print the stack trace to.
181:             *           Must not be <code>null</code>.
182:             */
183:            public void printStackTrace(PrintStream ps) {
184:                synchronized (ps) {
185:                    super .printStackTrace(ps);
186:                    if (cause != null) {
187:                        ps.println("--- Nested Exception ---");
188:                        cause.printStackTrace(ps);
189:                    }
190:                }
191:            }
192:
193:            /**
194:             * Prints the stack trace of this exception and any nested
195:             * exception to the specified PrintWriter.
196:             *
197:             * @param pw The PrintWriter to print the stack trace to.
198:             *           Must not be <code>null</code>.
199:             */
200:            public void printStackTrace(PrintWriter pw) {
201:                synchronized (pw) {
202:                    super .printStackTrace(pw);
203:                    if (cause != null) {
204:                        pw.println("--- Nested Exception ---");
205:                        cause.printStackTrace(pw);
206:                    }
207:                }
208:            }
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.