KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > parsers > FactoryConfigurationError


1 // $Id: FactoryConfigurationError.java,v 1.2 2003/12/06 00:21:42 jsuttor Exp $
2

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

9
10 package javax.xml.parsers;
11
12 /**
13  * Thrown when a problem with configuration with the Parser Factories
14  * exists. This error will typically be thrown when the class of a
15  * parser factory specified in the system properties cannot be found
16  * or instantiated.
17  *
18  * @author <a HREF="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
19  * @version $Revision: 1.2 $, $Date: 2003/12/06 00:21:42 $
20  */

21
22 public class FactoryConfigurationError extends Error JavaDoc {
23
24     /**
25      *<code>Exception</code> that represents the error.
26      */

27     private Exception JavaDoc exception;
28
29     /**
30      * Create a new <code>FactoryConfigurationError</code> with no
31      * detail mesage.
32      */

33
34     public FactoryConfigurationError() {
35         super();
36         this.exception = null;
37     }
38
39     /**
40      * Create a new <code>FactoryConfigurationError</code> with
41      * the <code>String </code> specified as an error message.
42      *
43      * @param msg The error message for the exception.
44      */

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

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

73     
74     public FactoryConfigurationError(Exception JavaDoc e, String JavaDoc msg) {
75         super(msg);
76         this.exception = e;
77     }
78
79
80     /**
81      * Return the message (if any) for this error . If there is no
82      * message for the exception and there is an encapsulated
83      * exception then the message of that exception, if it exists will be
84      * returned. Else the name of the encapsulated exception will be
85      * returned.
86      *
87      * @return The error message.
88      */

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

106     
107     public Exception JavaDoc getException () {
108         return exception;
109     }
110 }
111
Popular Tags