01: package net.sf.saxon.trans;
02:
03: import javax.xml.transform.SourceLocator;
04: import javax.xml.transform.TransformerException;
05:
06: /**
07: * Exception used for static errors in XPath, XSLT, or XQuery
08: */
09:
10: public class StaticError extends XPathException {
11:
12: public StaticError(String message) {
13: super (message);
14: }
15:
16: public StaticError(Exception err) {
17: super (err);
18: }
19:
20: public StaticError(String message, Throwable err) {
21: super (message, err);
22: }
23:
24: public StaticError(String message, SourceLocator loc) {
25: super (message, loc);
26: }
27:
28: /**
29: * Force an exception to a static error
30: */
31:
32: public StaticError makeStatic() {
33: return this ;
34: }
35:
36: public static StaticError makeStaticError(TransformerException err) {
37: if (err instanceof XPathException) {
38: return ((XPathException) err).makeStatic();
39: } else if (err.getException() instanceof XPathException) {
40: return ((XPathException) err.getException()).makeStatic();
41: } else {
42: return new StaticError(err);
43: }
44: }
45:
46: }
47:
48: //
49: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
50: // you may not use this file except in compliance with the License. You may obtain a copy of the
51: // License at http://www.mozilla.org/MPL/
52: //
53: // Software distributed under the License is distributed on an "AS IS" basis,
54: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
55: // See the License for the specific language governing rights and limitations under the License.
56: //
57: // The Original Code is: all this file.
58: //
59: // The Initial Developer of the Original Code is Michael H. Kay.
60: //
61: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
62: //
63: // Contributor(s): none.
64: //
|