1
/* Copyright 2002-2005 Elliotte Rusty Harold
3
This library is free software; you can redistribute it and/or modify
4
it under the terms of version 2.1 of the GNU Lesser General Public
5
License as published by the Free Software Foundation.
7
This library is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU Lesser General Public License for more details.
12
You should have received a copy of the GNU Lesser General Public
13
License along with this library; if not, write to the
14
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
15
Boston, MA 02111-1307 USA
17
You can contact Elliotte Rusty Harold by sending e-mail to
18
elharo@metalab.unc.edu. Please include the word "XOM" in the
19
subject line. The XOM home page is located at http://www.xom.nu/
26
* Thrown when an XSL stylesheet fails to compile
27
* or an XSL transform fails.
30
* @author Elliotte Rusty Harold
33
public class XSLException extends Exception {
35
private static final long serialVersionUID = -8605437693812807627L;
37
private Throwable cause;
42
* Creates a new <code>XSLException</code> with the specified
43
* detail message and an underlying root cause.
46
* @param message information about the cause of the exception
47
* @param cause the nested exception that caused this exception
49
public XSLException(String message, Throwable cause) {
51
this.initCause(cause);
57
* Creates a new <code>XSLException</code>
58
* with the specified detail message.
61
* @param message information about the cause of the exception
63
public XSLException(String message) {
68
// null is insufficient for detecting an uninitialized cause.
69
// The cause may be set to null which may not then be reset.
70
private boolean causeSet = false;
74
* Sets the root cause of this exception. This may
75
* only be called once. Subsequent calls throw an
76
* <code>IllegalStateException</code>.
80
* This method is unnecessary in Java 1.4 where it could easily be
81
* inherited from the superclass. However, including it here
82
* allows this method to be used in Java 1.3 and earlier.
85
* @param cause the root cause of this exception
87
* @return this <code>XSLException</code>
89
* @throws IllegalArgumentException if the cause is this exception
90
* (An exception cannot be its own cause.)
91
* @throws IllegalStateException if this method is called twice
93
public final Throwable initCause(Throwable cause) {
96
throw new IllegalStateException("Can't overwrite cause");
98
else if (cause == this) {
99
throw new IllegalArgumentException(
100
"Self-causation not permitted");
102
else this.cause = cause;
111
* Returns the underlying exception that caused this exception.
114
* @return the initial exception that caused this exception
117
public Throwable getCause() {