01 package javax.xml.stream;
02
03 /**
04 * An error class for reporting factory configuration errors.
05 *
06 * @version 1.0
07 * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
08 * @since 1.6
09 */
10 public class FactoryConfigurationError extends Error {
11
12 Exception nested;
13
14 /**
15 * Default constructor
16 */
17 public FactoryConfigurationError() {
18 }
19
20 /**
21 * Construct an exception with a nested inner exception
22 *
23 * @param e the exception to nest
24 */
25 public FactoryConfigurationError(java.lang.Exception e) {
26 nested = e;
27 }
28
29 /**
30 * Construct an exception with a nested inner exception
31 * and a message
32 *
33 * @param e the exception to nest
34 * @param msg the message to report
35 */
36 public FactoryConfigurationError(java.lang.Exception e,
37 java.lang.String msg) {
38 super (msg);
39 nested = e;
40 }
41
42 /**
43 * Construct an exception with a nested inner exception
44 * and a message
45 *
46 * @param msg the message to report
47 * @param e the exception to nest
48 */
49 public FactoryConfigurationError(java.lang.String msg,
50 java.lang.Exception e) {
51 super (msg);
52 nested = e;
53 }
54
55 /**
56 * Construct an exception with associated message
57 *
58 * @param msg the message to report
59 */
60 public FactoryConfigurationError(java.lang.String msg) {
61 super (msg);
62 }
63
64 /**
65 * Return the nested exception (if any)
66 *
67 * @return the nested exception or null
68 */
69 public Exception getException() {
70 return nested;
71 }
72
73 /**
74 * Report the message associated with this error
75 *
76 * @return the string value of the message
77 */
78 public String getMessage() {
79 String msg = super.getMessage();
80 if (msg != null)
81 return msg;
82 if (nested != null) {
83 msg = nested.getMessage();
84 if (msg == null)
85 msg = nested.getClass().toString();
86 }
87 return msg;
88 }
89
90 }
|