001/* 002 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved. 003 * 004 * This software is open source. 005 * See the bottom of this file for the licence. 006 * 007 * $Id: XPathException.java,v 1.1 2001/08/01 09:17:21 jstrachan Exp $ 008 */ 009 010package org.dom4j; 011 012/** <p><code>XPathException</code> is thrown when an exception 013 * occurs while evaluating an XPath expression, usually due to some function 014 * throwing an exception.</p> 015 * 016 * @version $Revision: 1.1 $ 017 */ 018public class XPathException extends RuntimeException { 019 020 /** The XPath expression that caused the exception */ 021 private String xpath; 022 023 public XPathException(String xpath) { 024 super( "Exception occurred evaluting XPath: " + xpath ); 025 this.xpath = xpath; 026 } 027 028 public XPathException(String xpath, String reason) { 029 super( "Exception occurred evaluting XPath: " + xpath + " " + reason ); 030 this.xpath = xpath; 031 } 032 033 public XPathException(String xpath, Exception e) { 034 super( "Exception occurred evaluting XPath: " + xpath + ". Exception: " + e.getMessage() ); 035 this.xpath = xpath; 036 } 037 038 /** Returns the XPath expression that caused the problem */ 039 public String getXPath() { 040 return xpath; 041 } 042} 043 044 045 046 047/* 048 * Redistribution and use of this software and associated documentation 049 * ("Software"), with or without modification, are permitted provided 050 * that the following conditions are met: 051 * 052 * 1. Redistributions of source code must retain copyright 053 * statements and notices. Redistributions must also contain a 054 * copy of this document. 055 * 056 * 2. Redistributions in binary form must reproduce the 057 * above copyright notice, this list of conditions and the 058 * following disclaimer in the documentation and/or other 059 * materials provided with the distribution. 060 * 061 * 3. The name "DOM4J" must not be used to endorse or promote 062 * products derived from this Software without prior written 063 * permission of MetaStuff, Ltd. For written permission, 064 * please contact dom4j-info@metastuff.com. 065 * 066 * 4. Products derived from this Software may not be called "DOM4J" 067 * nor may "DOM4J" appear in their names without prior written 068 * permission of MetaStuff, Ltd. DOM4J is a registered 069 * trademark of MetaStuff, Ltd. 070 * 071 * 5. Due credit should be given to the DOM4J Project 072 * (http://dom4j.org/). 073 * 074 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS 075 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 076 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 077 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 078 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 079 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 080 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 081 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 082 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 083 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 084 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 085 * OF THE POSSIBILITY OF SUCH DAMAGE. 086 * 087 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved. 088 * 089 * $Id: XPathException.java,v 1.1 2001/08/01 09:17:21 jstrachan Exp $ 090 */