KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > transform > TransformerFactoryConfigurationError


1 /*
2  * @(#)TransformerFactoryConfigurationError.java 1.13 04/07/26
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.xml.transform;
8
9 /**
10  * Thrown when a problem with configuration with the Transformer Factories
11  * exists. This error will typically be thrown when the class of a
12  * transformation factory specified in the system properties cannot be found
13  * or instantiated.
14  */

15 public class TransformerFactoryConfigurationError extends Error JavaDoc {
16
17     /**
18      * <code>Exception</code> for the
19      * <code>TransformerFactoryConfigurationError</code>.
20      */

21     private Exception JavaDoc exception;
22
23     /**
24      * Create a new <code>TransformerFactoryConfigurationError</code> with no
25      * detail mesage.
26      */

27     public TransformerFactoryConfigurationError() {
28
29         super();
30
31         this.exception = null;
32     }
33
34     /**
35      * Create a new <code>TransformerFactoryConfigurationError</code> with
36      * the <code>String</code> specified as an error message.
37      *
38      * @param msg The error message for the exception.
39      */

40     public TransformerFactoryConfigurationError(String JavaDoc msg) {
41
42         super(msg);
43
44         this.exception = null;
45     }
46
47     /**
48      * Create a new <code>TransformerFactoryConfigurationError</code> with a
49      * given <code>Exception</code> base cause of the error.
50      *
51      * @param e The exception to be encapsulated in a
52      * TransformerFactoryConfigurationError.
53      */

54     public TransformerFactoryConfigurationError(Exception JavaDoc e) {
55
56         super(e.toString());
57
58         this.exception = e;
59     }
60
61     /**
62      * Create a new <code>TransformerFactoryConfigurationError</code> with the
63      * given <code>Exception</code> base cause and detail message.
64      *
65      * @param e The exception to be encapsulated in a
66      * TransformerFactoryConfigurationError
67      * @param msg The detail message.
68      */

69     public TransformerFactoryConfigurationError(Exception JavaDoc e, String JavaDoc msg) {
70
71         super(msg);
72
73         this.exception = e;
74     }
75
76     /**
77      * Return the message (if any) for this error . If there is no
78      * message for the exception and there is an encapsulated
79      * exception then the message of that exception will be returned.
80      *
81      * @return The error message.
82      */

83     public String JavaDoc getMessage() {
84
85         String JavaDoc message = super.getMessage();
86
87         if ((message == null) && (exception != null)) {
88             return exception.getMessage();
89         }
90
91         return message;
92     }
93
94     /**
95      * Return the actual exception (if any) that caused this exception to
96      * be raised.
97      *
98      * @return The encapsulated exception, or null if there is none.
99      */

100     public Exception JavaDoc getException() {
101         return exception;
102     }
103 }
104
Popular Tags