View Javadoc

1   /*--
2    Copyright 2001, 2002 Elliotte Rusty Harold.
3    All rights reserved.
4    This file is part of XIncluder, a Java class library for integrating XInclude
5    processing with SAX, DOM, and JDOM.
6    XIncluder is free software; you can redistribute it and/or modify
7    it under the terms of the GNU Lesser General Public License version 2.1
8    as published by the Free Software Foundation.
9    XIncluder is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU Lesser General Public License for more details.
13   You should have received a copy of the GNU Lesser General Public License
14   along with XIncluder; if not, write to the Free Software
15   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
17   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19   DISCLAIMED.  IN NO EVENT SHALL ELLIOTTE RUSTY HAROLD OR ANY
20   OTHER CONTRIBUTORS TO THIS PACKAGE
21   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28   SUCH DAMAGE.
29   */
30  package net.sf.tomp.xml.include;
31  
32  /***
33   * <p>
34   * <code>XIncludeException</code> is the generic superclass for all checked
35   * exceptions that may be thrown as a result of a violation of XInclude's rules.
36   * </p>
37   * 
38   * @author Elliotte Rusty Harold
39   * @version 1.0d9, July 4, 2002
40   */
41  public class XIncludeException extends Exception {
42      private Throwable rootCause = null;
43  
44      /***
45       * Constructs an <code>XIncludeException</code> with <code>null</code>
46       * as its error detail message.
47       */
48      public XIncludeException() {
49      }
50  
51      /***
52       * Constructs an <code>XIncludeException</code> with the specified detail
53       * message. The error message string <code>message</code> can later be
54       * retrieved by the <code>{@link java.lang.Throwable#getMessage}</code>
55       * method of class <code>java.lang.Throwable</code>.
56       * 
57       * @param message the detail message.
58       */
59      public XIncludeException(String message) {
60          super(message);
61      }
62  
63      /***
64       * When an <code>IOException</code>,<code>MalformedURLException</code>
65       * or other generic exception is thrown while processing an XML document for
66       * XIncludes, it is customarily replaced by some form of
67       * <code>XIncludeException</code>. This method allows you to store the
68       * original exception.
69       * 
70       * @param nestedException the underlying exception which caused the
71       *            XIncludeException to be thrown
72       */
73      public void setRootCause(Throwable nestedException) {
74          this.rootCause = nestedException;
75      }
76  
77      /***
78       * When an <code>IOException</code>,<code>MalformedURLException</code>
79       * or other generic exception is thrown while processing an XML document for
80       * XIncludes, it is customarily replaced by some form of
81       * <code>XIncludeException</code>. This method allows you to retrieve the
82       * original exception. It returns null if no such exception caused this
83       * <code>XIncludeException</code>.
84       * 
85       * @return Throwable the underlying exception which caused the
86       *         XIncludeException to be thrown
87       */
88      public Throwable getRootCause() {
89          return this.rootCause;
90      }
91  }
92  
93  /*
94   * The contents of this file are subject to the Mozilla Public License Version
95   * 1.1 (the "License"); you may not use this file except in compliance with the
96   * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
97   * Software distributed under the License is distributed on an "AS IS" basis,
98   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
99   * the specific language governing rights and limitations under the License. The
100  * Original Code is: all this file. The Initial Developer of the Original Code
101  * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
102  */