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: */
09: public class FactoryConfigurationError extends Error {
10:
11: Exception nested;
12:
13: /**
14: * Default constructor
15: */
16: public FactoryConfigurationError() {
17: }
18:
19: /**
20: * Construct an exception with a nested inner exception
21: *
22: * @param e the exception to nest
23: */
24: public FactoryConfigurationError(java.lang.Exception e) {
25: nested = e;
26: }
27:
28: /**
29: * Construct an exception with a nested inner exception
30: * and a message
31: *
32: * @param e the exception to nest
33: * @param msg the message to report
34: */
35: public FactoryConfigurationError(java.lang.Exception e,
36: java.lang.String msg) {
37: super (msg);
38: nested = e;
39: }
40:
41: /**
42: * Construct an exception with a nested inner exception
43: * and a message
44: *
45: * @param msg the message to report
46: * @param e the exception to nest
47: */
48: public FactoryConfigurationError(java.lang.String msg,
49: java.lang.Exception e) {
50: super (msg);
51: nested = e;
52: }
53:
54: /**
55: * Construct an exception with associated message
56: *
57: * @param e the exception to nest
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: }
|