1 /*
2 * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
3 *
4 * This software is open source.
5 * See the bottom of this file for the licence.
6 *
7 * $Id: XPathException.java,v 1.4 2004/06/25 08:03:33 maartenc Exp $
8 */
9
10 package org.dom4j;
11
12 /*** <p><code>XPathException</code> is thrown when an exception
13 * occurs while evaluating an XPath expression, usually due to some function
14 * throwing an exception.</p>
15 *
16 * @version $Revision: 1.4 $
17 */
18 public class XPathException extends RuntimeException {
19
20 /*** The XPath expression that caused the exception */
21 private String xpath;
22
23 public XPathException(String xpath) {
24 super( "Exception occurred evaluting XPath: " + xpath );
25 this.xpath = xpath;
26 }
27
28 public XPathException(String xpath, String reason) {
29 super( "Exception occurred evaluting XPath: " + xpath + " " + reason );
30 this.xpath = xpath;
31 }
32
33 public XPathException(String xpath, Exception e) {
34 super( "Exception occurred evaluting XPath: " + xpath + ". Exception: " + e.getMessage() );
35 this.xpath = xpath;
36 }
37
38 /*** Returns the XPath expression that caused the problem */
39 public String getXPath() {
40 return xpath;
41 }
42 }
43
44
45
46
47 /*
48 * Redistribution and use of this software and associated documentation
49 * ("Software"), with or without modification, are permitted provided
50 * that the following conditions are met:
51 *
52 * 1. Redistributions of source code must retain copyright
53 * statements and notices. Redistributions must also contain a
54 * copy of this document.
55 *
56 * 2. Redistributions in binary form must reproduce the
57 * above copyright notice, this list of conditions and the
58 * following disclaimer in the documentation and/or other
59 * materials provided with the distribution.
60 *
61 * 3. The name "DOM4J" must not be used to endorse or promote
62 * products derived from this Software without prior written
63 * permission of MetaStuff, Ltd. For written permission,
64 * please contact dom4j-info@metastuff.com.
65 *
66 * 4. Products derived from this Software may not be called "DOM4J"
67 * nor may "DOM4J" appear in their names without prior written
68 * permission of MetaStuff, Ltd. DOM4J is a registered
69 * trademark of MetaStuff, Ltd.
70 *
71 * 5. Due credit should be given to the DOM4J Project -
72 * http://www.dom4j.org
73 *
74 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
75 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
76 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
77 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
78 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
79 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
80 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
81 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
82 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
83 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
84 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
85 * OF THE POSSIBILITY OF SUCH DAMAGE.
86 *
87 * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
88 *
89 * $Id: XPathException.java,v 1.4 2004/06/25 08:03:33 maartenc Exp $
90 */