KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > trans > StaticError


1 package net.sf.saxon.trans;
2 import javax.xml.transform.SourceLocator JavaDoc;
3 import javax.xml.transform.TransformerException JavaDoc;
4
5 /**
6 * Exception used for static errors in XPath, XSLT, or XQuery
7 */

8
9 public class StaticError extends XPathException {
10
11     public StaticError(String JavaDoc message) {
12         super(message);
13     }
14
15     public StaticError(Exception JavaDoc err) {
16         super(err);
17     }
18
19     public StaticError(String JavaDoc message, Throwable JavaDoc err) {
20         super(message, err);
21     }
22
23     public StaticError(String JavaDoc message, SourceLocator JavaDoc loc) {
24         super(message, loc);
25     }
26
27     /**
28      * Force an exception to a static error
29      */

30
31     public StaticError makeStatic() {
32         return this;
33     }
34
35     public static StaticError makeStaticError(TransformerException JavaDoc err) {
36         if (err instanceof XPathException) {
37             return ((XPathException)err).makeStatic();
38         } else if (err.getException() instanceof XPathException) {
39             return ((XPathException)err.getException()).makeStatic();
40         } else {
41             return new StaticError(err);
42         }
43     }
44
45 }
46
47 //
48
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
49
// you may not use this file except in compliance with the License. You may obtain a copy of the
50
// License at http://www.mozilla.org/MPL/
51
//
52
// Software distributed under the License is distributed on an "AS IS" basis,
53
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
54
// See the License for the specific language governing rights and limitations under the License.
55
//
56
// The Original Code is: all this file.
57
//
58
// The Initial Developer of the Original Code is Michael H. Kay.
59
//
60
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
61
//
62
// Contributor(s): none.
63
//
64

65
Popular Tags