1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.struts.tiles;
21
22 /***
23 * Exception thrown when an error occurs while the factory tries to
24 * create a new instance mapper.
25 */
26 public class DefinitionsFactoryException extends TilesException
27 {
28 /***
29 * Constructor.
30 */
31 public DefinitionsFactoryException()
32 {
33 super();
34 this.exception = null;
35 }
36
37 /***
38 * Constructor.
39 * @param message The error or warning message.
40 */
41 public DefinitionsFactoryException(String message)
42 {
43 super(message);
44 this.exception = null;
45 }
46
47
48 /***
49 * Create a new <code>DefinitionsFactoryException</code> wrapping an existing exception.
50 *
51 * <p>The existing exception will be embedded in the new
52 * one and its message will become the default message for
53 * the DefinitionsFactoryException.</p>
54 *
55 * @param e The exception to be wrapped.
56 */
57 public DefinitionsFactoryException(Exception e)
58 {
59 super();
60 this.exception = e;
61 }
62
63
64 /***
65 * Create a new <code>DefinitionsFactoryException</code> from an existing exception.
66 *
67 * <p>The existing exception will be embedded in the new
68 * one, but the new exception will have its own message.</p>
69 *
70 * @param message The detail message.
71 * @param e The exception to be wrapped.
72 */
73 public DefinitionsFactoryException(String message, Exception e)
74 {
75 super(message);
76 this.exception = e;
77 }
78
79
80 /***
81 * Return a detail message for this exception.
82 *
83 * <p>If there is a embedded exception, and if the DefinitionsFactoryException
84 * has no detail message of its own, this method will return
85 * the detail message from the embedded exception.</p>
86 *
87 * @return The error or warning message.
88 */
89 public String getMessage ()
90 {
91 String message = super.getMessage ();
92
93 if (message == null && exception != null) {
94 return exception.getMessage();
95 } else {
96 return message;
97 }
98 }
99
100
101 /***
102 * Return the embedded exception, if any.
103 * @return The embedded exception, or <code>null</code> if there is none.
104 */
105 public Exception getException ()
106 {
107 return exception;
108 }
109
110
111
112
113
114
115 /***
116 * Any "wrapped" exception will be exposed when this is serialized.
117 * @serial
118 */
119 private Exception exception;
120 }