| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.trans; |
| 9 | |
| 10 | /** |
| 11 | * When tree construction is deferred, innocuous methods such as NodeInfo#getLocalName() may |
| 12 | * trigger a dynamic error. Rather than make all such methods on NodeInfo throw a checked XPathException, |
| 13 | * we instead throw an UncheckedXPathException, which is a simple wrapper for an XPathException. |
| 14 | * Appropriate places in the client code must check for this condition and translate it back into an |
| 15 | * XPathException. |
| 16 | */ |
| 17 | |
| 18 | public class UncheckedXPathException extends RuntimeException { |
| 19 | |
| 20 | private XPathException cause; |
| 21 | |
| 22 | public UncheckedXPathException(XPathException cause) { |
| 23 | this.cause = cause; |
| 24 | } |
| 25 | |
| 26 | public XPathException getXPathException() { |
| 27 | return cause; |
| 28 | } |
| 29 | |
| 30 | public String getMessage() { |
| 31 | return cause.getMessage(); |
| 32 | } |
| 33 | } |